-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): default booleans are parsed from strings as well (#5504)
- Loading branch information
Showing
10 changed files
with
845 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 0.46.17 | ||
**`(fix):`** Support parsing string values for boolean defaults in OpenAPI schemas. | ||
* String values like "true" and "false" are now correctly parsed as boolean defaults. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
...rs/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"absoluteFilePath": "/DUMMY_PATH", | ||
"importedDefinitions": {}, | ||
"namedDefinitionFiles": { | ||
"__package__.yml": { | ||
"absoluteFilepath": "/DUMMY_PATH", | ||
"contents": { | ||
"service": { | ||
"auth": false, | ||
"base-path": "", | ||
"endpoints": { | ||
"getTest": { | ||
"auth": false, | ||
"docs": undefined, | ||
"examples": [ | ||
{ | ||
"response": { | ||
"body": { | ||
"boolField1": true, | ||
"boolField2": true, | ||
"numberField": 1.1, | ||
"stringField": "stringField", | ||
}, | ||
}, | ||
}, | ||
], | ||
"method": "GET", | ||
"pagination": undefined, | ||
"path": "/test", | ||
"request": { | ||
"name": "GetTestRequest", | ||
"query-parameters": { | ||
"boolParam1": "optional<boolean>", | ||
"boolParam2": "optional<boolean>", | ||
"boolParam3": "optional<boolean>", | ||
"boolParam4": "optional<boolean>", | ||
"integerParam": "optional<integer>", | ||
"numberParam": "optional<double>", | ||
"stringParam": "optional<string>", | ||
}, | ||
}, | ||
"response": { | ||
"docs": "Successful response", | ||
"type": "GetTestResponse", | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
"types": { | ||
"GetTestResponse": { | ||
"docs": undefined, | ||
"inline": undefined, | ||
"properties": { | ||
"boolField1": { | ||
"default": true, | ||
"type": "optional<boolean>", | ||
}, | ||
"boolField2": { | ||
"default": true, | ||
"type": "optional<boolean>", | ||
}, | ||
"numberField": { | ||
"default": 3.14, | ||
"type": "optional<double>", | ||
}, | ||
"stringField": { | ||
"default": "defaultValue", | ||
"type": "optional<string>", | ||
}, | ||
}, | ||
"source": { | ||
"openapi": "../openapi.yml", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"rawContents": "types: | ||
GetTestResponse: | ||
properties: | ||
boolField1: | ||
type: optional<boolean> | ||
default: true | ||
boolField2: | ||
type: optional<boolean> | ||
default: true | ||
stringField: | ||
type: optional<string> | ||
default: defaultValue | ||
numberField: | ||
type: optional<double> | ||
default: 3.14 | ||
source: | ||
openapi: ../openapi.yml | ||
service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
getTest: | ||
path: /test | ||
method: GET | ||
auth: false | ||
source: | ||
openapi: ../openapi.yml | ||
request: | ||
name: GetTestRequest | ||
query-parameters: | ||
boolParam1: optional<boolean> | ||
boolParam2: optional<boolean> | ||
boolParam3: optional<boolean> | ||
boolParam4: optional<boolean> | ||
stringParam: optional<string> | ||
numberParam: optional<double> | ||
integerParam: optional<integer> | ||
response: | ||
docs: Successful response | ||
type: GetTestResponse | ||
examples: | ||
- response: | ||
body: | ||
boolField1: true | ||
boolField2: true | ||
stringField: stringField | ||
numberField: 1.1 | ||
source: | ||
openapi: ../openapi.yml | ||
", | ||
}, | ||
}, | ||
"packageMarkers": {}, | ||
"rootApiFile": { | ||
"contents": { | ||
"display-name": "API with Default Values", | ||
"error-discrimination": { | ||
"strategy": "status-code", | ||
}, | ||
"name": "api", | ||
}, | ||
"defaultUrl": undefined, | ||
"rawContents": "name: api | ||
error-discrimination: | ||
strategy: status-code | ||
display-name: API with Default Values | ||
", | ||
}, | ||
} |
104 changes: 104 additions & 0 deletions
104
...pi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir-in-memory/defaults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"type": "openapi", | ||
"value": { | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "API with Default Values", | ||
"version": "1.0.0" | ||
}, | ||
"paths": { | ||
"/test": { | ||
"get": { | ||
"parameters": [ | ||
{ | ||
"name": "boolParam1", | ||
"in": "query", | ||
"schema": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
}, | ||
{ | ||
"name": "boolParam2", | ||
"in": "query", | ||
"schema": { | ||
"type": "boolean", | ||
"default": "true" | ||
} | ||
}, | ||
{ | ||
"name": "boolParam3", | ||
"in": "query", | ||
"schema": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
}, | ||
{ | ||
"name": "boolParam4", | ||
"in": "query", | ||
"schema": { | ||
"type": "boolean", | ||
"default": "false" | ||
} | ||
}, | ||
{ | ||
"name": "stringParam", | ||
"in": "query", | ||
"schema": { | ||
"type": "string", | ||
"default": "defaultString" | ||
} | ||
}, | ||
{ | ||
"name": "numberParam", | ||
"in": "query", | ||
"schema": { | ||
"type": "number", | ||
"default": 42 | ||
} | ||
}, | ||
{ | ||
"name": "integerParam", | ||
"in": "query", | ||
"schema": { | ||
"type": "integer", | ||
"default": 100 | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Successful response", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"boolField1": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"boolField2": { | ||
"type": "boolean", | ||
"default": "true" | ||
}, | ||
"stringField": { | ||
"type": "string", | ||
"default": "defaultValue" | ||
}, | ||
"numberField": { | ||
"type": "number", | ||
"default": 3.14 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.