Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra (unnecessary?) type generated when processing url encoded body swagger #3897

Closed
chamons opened this issue Feb 19, 2021 · 6 comments
Closed
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.

Comments

@chamons
Copy link

chamons commented Feb 19, 2021

Describe the bug

In this PR we found an extra type/class was generated:

Paths14Hl8BdFormsdataurlencodedPetAddPetidPostRequestbodyContentApplicationXWwwFormUrlencodedSchema

This was a minor annoyance for .NET, as we mark it internal, but might be more annoying for other languages.

Swagger
Generated File

Expected behavior
@pakrym and I expected this type to be not added.

@chamons chamons added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 19, 2021
@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 19, 2021

I think is this the same issue as #3668

@pakrym
Copy link
Contributor

pakrym commented Feb 22, 2021

I don't think so. In that case, the schema is defined by the customer in the swagger. In this case, it's an artifact of the autorest transformations.

@pakrym pakrym reopened this Feb 22, 2021
@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 22, 2021

well it is arguable. In OpenAPI3 there is a schema like that, when converting from swagger -> opeanpi3 it makes this schema and then it reflatten it. but if you are using openapi3 directly then this schema is defined in your specs

@pakrym
Copy link
Contributor

pakrym commented Feb 22, 2021

I might be missing something. Can you refer to the openapi specification where it talks about explicitly defining schemas for urlencoded bodies?

@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 22, 2021

As far as I understand in OpenApi3. You have a single entry for the schema requestbody and then you can define the schema per content type

https://swagger.io/docs/specification/describing-request-body/

paths:
  /survey:
    post:
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                name:          # <!--- form field name
                  type: string
                fav_number:    # <!--- form field name
                  type: integer
              required:
                - name
                - email

@pakrym
Copy link
Contributor

pakrym commented Feb 22, 2021

TIL. thank you

@pakrym pakrym closed this as completed Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
Development

No branches or pull requests

3 participants