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

swagger2openapi: missed request body contenttype after conversion from swagger v2 to openAPI v3.0.x #527

Open
GreoGi opened this issue Dec 14, 2021 · 0 comments

Comments

@GreoGi
Copy link

GreoGi commented Dec 14, 2021

Checklist

  • [ x ] Conversion: I have checked my source definition is valid OpenAPI 2.0 (checked in bigstickcarpet swagger validator)
  • [ x ] Conversion: On valid OpenAPI 2.0 input, the conversion looks wrong

Other stuff

  • swagger2openapi version is 7.0.8
  • I am using node.js api
  • options object is: { warnOnly: true, patch: true }

Detailed Description

I have simple swagger 2 doc: (click to reveal spoiler)
swagger: '2.0'
info:
  version: v1
  title: test doc
  description: testDoc
host: dev.null.test
schemes:
  - https
  - http
paths:
  /some/path:
    post:
      description: some method
      operationId: doSomething
      consumes:
        - application/x-www-form-urlencoded
        - multipart/form-data
      produces:
        - application/json
      parameters:
        - name: client_id
          in: formData
          description: Client identifier (serviceName)
          required: true
          type: string
        - name: client_secret
          in: formData
          description: Сlient secret (api-key)
          required: true
          type: string
        - name: access_type
          in: formData
          description: Access scheme
          required: true
          type: string
        - name: scope
          in: formData
          description: scope
          required: false
          type: string
        - name: username
          in: formData
          description: User's login
          required: false
          type: string
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/AccessTokenResponse'
        '500':
          description: ServerError
          schema:
            type: string
definitions:
  AccessTokenResponse:
    required:
      - access_token
    type: object
    properties:
      access_token:
        description: Access token
        type: string
      expires_in:
        description: Lifetime of token
        type: integer
      token_type:
        description: Token type
        type: string
        default: Bearer

with 1 endpoint which consumes 2 content-types: application/x-www-form-urlencoded and multipart/form-data.
After conversion to openAPI v3.0.x application/x-www-form-urlencoded content-type is missing.

I also converted my swagger doc at https://mermade.org.uk/openapi-converter and saw same result

I think this is a bug because conversion to openAPI v3.0.x at https://editor.swagger.io/ doesn't erase application/x-www-form-urlencoded content-type

@GreoGi GreoGi changed the title swagger2openapi: missed request body conenttype after conversion from swagger v2 to openAPI v3.0.x swagger2openapi: missed request body contenttype after conversion from swagger v2 to openAPI v3.0.x Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant