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

[o2k] fix parameter default styles #3327

Merged
merged 2 commits into from Apr 27, 2021
Merged

[o2k] fix parameter default styles #3327

merged 2 commits into from Apr 27, 2021

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Apr 26, 2021

PR #3256 changed the default style from "simple" to "form". But that is not correct, the default style depends on the type of parameter.

This PR corrects it and adds the proper style for each of the 4 types of parameters, as specified in the OAS docs here: https://swagger.io/docs/specification/serialization/

fixes INS-654

@@ -62,7 +69,7 @@ function generateParameterSchema(operation?: OA3Operation): Array<Object> | type
required: !!(p: Object).required,
name: (p: Object).name,
schema,
style: (p: Object).style ?? 'form',
style: (p: Object).style ?? DEFAULT_PARAM_STYLE[(p: Object).in],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if p.in is not header, cookie, query or path then this will likely return undefined

PR #3256 changed the default style from "simple" to "form". But that
is not correct, the default style depends on the type of parameter.

This PR corrects iit and adds the proper style for each of the 4
types of parameters, as specified in the OAS docs here:
https://swagger.io/docs/specification/serialization/
Copy link
Contributor

@develohpanda develohpanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to be working as expected with the following iterations:

      parameters:
        - in:
          style: acbd
          name: userId
          schema:
            type: integer
          required: true
      parameters:
        - in: asdfadsf
          name: userId
          schema:
            type: integer
          required: true
      parameters:
        - in: path
          name: userId
          schema:
            type: integer
          required: true

@develohpanda develohpanda merged commit 28db994 into develop Apr 27, 2021
@develohpanda develohpanda deleted the param-defaults branch April 27, 2021 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PA-openapi-2-kong Package: OpenAPI 2 Kong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants