Skip to content

v2 to v3 converter: extension in parameters are lost #810

Closed

Description

@jmini

Give this Swagger v2 Spec:

swagger: "2.0"
info:
  version: "1.0.1"
  title: "OpenAPI-Generator PR 889"
basePath: "/v1"
paths:
  /one:
    get:
      operationId: "op1"
      parameters:
        - name: status
          in: query
          description: Some status value
          required: true
          type: string
          x-nullable: true
      responses:
        200:
          description: "success"

The extension x-nullable: true in the parameter is ignored.

openAPI.getPaths().get("/one").getGet().getParameters().get(0).getExtensions().size()

returns 0, should be 1.

If you reexport the parsed result you get:

openapi: 3.0.1
info:
  title: OpenAPI-Generator PR 889
  version: 1.0.1
servers:
- url: /v1
paths:
  /one:
    get:
      operationId: op1
      parameters:
      - name: status
        in: query
        description: Status values that need to be considered for filter
        required: true
        schema:
          type: string
          nullable: true
      responses:
        200:
          description: success
          content: {}
components: {}

Activity

  1. jmini commented on Aug 29, 2018

    @jmini
    ContributorAuthor

    Never mind, as you can see in the posted example, it works as expected.

    x-nullable: true from the OASv2 Parameter is converted to OASv3:

      schema:
        type: string
        nullable: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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