Skip to content

Support for POST endpoints with text/plain inputs? #275

@Numpsy

Description

@Numpsy

Hi,

I see that some work for text outputs was done for #268, but I wonder if text inputs are supported or have similar issues?

As an example, if I have an ASP.Net Core minimal api of this sort:

app.MapPost("/weatherforecast", ([FromBody] string body) =>
{
    return "Wet";
}).Accepts<string>("text/plain");

Then the generated schema is like this

 "requestBody": {
          "content": {
            "text/plain": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },

And the type provider gives errors like

The type provider 'SwaggerProvider.OpenApiClientTypeProvider' reported an error: Operation '' does not contain supported media types ["text/plain"]

So is this something that needs more work in the provider to support?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions