google / google/gnostic

`omitempty` is not appropriate for `explode` field

Open
#470 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.