Skip to content

omitempty is not appropriate for explode field #470

@auzhva

Description

@auzhva

According to OpenAPI specs, explode field defaults to true in case of style: form and to false otherwise.

But in Gnostic model follows the standard "false by default" and its outputting false value even in case if it's not by default.

This means that if I read below spec by gnostic:

{
  "openapi": "3.1.1",
  "paths": {
    "/users": {
      "get": {
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "explode": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    }
  }
}

And output it back, it will write:

{
  "openapi": "3.1.1",
  "paths": {
    "/users": {
      "get": {
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    }
  }
}

Which is not the same thing.

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