Skip to content

requestBody not correctly populated when Parameters is a list of $refs (OAS 2 to 3 conversion) #765

@charlesyu108

Description

@charlesyu108

When parsing and converting a OAS 2 doc to OAS 3, I find that the requestBody field is not being created if the original doc has its Parameters defined as a list of $refs like so:
OAS 2:

  post:
      consumes:
        - application/json
        - application/x-www-form-urlencoded
      description: ''
      operationId: createBlock
      parameters:
        - $ref: '#/parameters/UsernamePath'
        - $ref: '#/parameters/Block'
        - $ref: '#/parameters/DashboardIDPath'
      responses: ...

OAS3:

"post" : {
        "tags" : [ "Blocks" ],
        "summary" : "Create a new Block",
        "operationId" : "createBlock",
        "parameters" : [ {
          "$ref" : "#/components/parameters/UsernamePath",
          "extensions" : { }
        }, {
          "$ref" : "#/components/requestBodies/Block",
          "extensions" : { }
        }, {
          "$ref" : "#/components/parameters/DashboardIDPath",
          "extensions" : { }
        } ],
        "responses" : { ...

The references are correctly resolved to rightful locations, but the field for requestBody is absent. Furthermore, the parameter that should now be included in requestBody is still under parameters.

Doc in question:
https://api.apis.guru/v2/specs/adafruit.com/2.0.0/swagger.yaml

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