Mermade / oas-kit

Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
https://mermade.org.uk/openapi-converter
BSD 3-Clause "New" or "Revised" License
707 stars 129 forks source link

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

Open GreoGi opened 2 years ago

GreoGi commented 2 years ago

Checklist

Other stuff

Detailed Description

I have simple swagger 2 doc: (click to reveal spoiler) ```yml 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