Skip to content

Commit

Permalink
fix(cli): add a mode to support parsing deep object query parameters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Nov 7, 2024
1 parent 2013db6 commit 9debc6b
Show file tree
Hide file tree
Showing 21 changed files with 943 additions and 29 deletions.
3 changes: 3 additions & 0 deletions fern/apis/generators-yml/definition/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ types:
title-as-schema-name: optional<boolean>
optional-additional-properties: optional<boolean>
coerce-enums-to-literals: optional<boolean>
object-query-parameters:
type: optional<boolean>
docs: Enables parsing deep object query parameters

OpenAPISpecSchema:
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"ignores": [
"@types/jest",
"globals",
"@types/node"
],
"ignore-patterns": [
"lib"
]
}
"ignores": ["@types/jest", "globals", "@types/node"],
"ignore-patterns": ["lib"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"typescript": "4.6.4",
"vitest": "^2.0.5"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface SpecImportSettings {
asyncApiNaming?: "v1" | "v2";
optionalAdditionalProperties: boolean;
cooerceEnumsToLiterals: boolean;
objectQueryParameters: boolean;
}

export type Source = AsyncAPISource | OpenAPISource | ProtobufSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"absoluteFilePath": "/DUMMY_PATH",
"importedDefinitions": {},
"namedDefinitionFiles": {
"__package__.yml": {
"absoluteFilepath": "/DUMMY_PATH",
"contents": {
"service": {
"auth": false,
"base-path": "",
"endpoints": {
"search": {
"auth": false,
"docs": undefined,
"examples": [
{
"response": {
"body": {
"results": [
"results",
],
},
},
},
],
"method": "GET",
"pagination": undefined,
"path": "/search",
"request": {
"name": "SearchRequest",
"query-parameters": {
"filter": "optional<SearchRequestFilter>",
"limit": "optional<integer>",
"sort": "optional<SearchRequestSort>",
"tags": {
"allow-multiple": true,
"type": "optional<string>",
},
},
},
"response": {
"docs": "Successful response",
"type": "SearchResponse",
},
"source": {
"openapi": "../openapi.yml",
},
},
},
"source": {
"openapi": "../openapi.yml",
},
},
"types": {
"SearchRequestFilter": {
"docs": undefined,
"properties": {
"age": "optional<integer>",
"location": "optional<SearchRequestFilterLocation>",
"name": "optional<string>",
},
"source": {
"openapi": "../openapi.yml",
},
},
"SearchRequestFilterLocation": {
"docs": undefined,
"properties": {
"city": "optional<string>",
"coordinates": "optional<SearchRequestFilterLocationCoordinates>",
"country": "optional<string>",
},
"source": {
"openapi": "../openapi.yml",
},
},
"SearchRequestFilterLocationCoordinates": {
"docs": undefined,
"properties": {
"latitude": "optional<double>",
"longitude": "optional<double>",
},
"source": {
"openapi": "../openapi.yml",
},
},
"SearchRequestSort": {
"enum": [
"asc",
"desc",
],
"source": {
"openapi": "../openapi.yml",
},
},
"SearchResponse": {
"docs": undefined,
"properties": {
"results": "optional<list<string>>",
},
"source": {
"openapi": "../openapi.yml",
},
},
},
},
"rawContents": "types:
SearchRequestFilterLocationCoordinates:
properties:
latitude: optional<double>
longitude: optional<double>
source:
openapi: ../openapi.yml
SearchRequestFilterLocation:
properties:
city: optional<string>
country: optional<string>
coordinates: optional<SearchRequestFilterLocationCoordinates>
source:
openapi: ../openapi.yml
SearchRequestFilter:
properties:
name: optional<string>
age: optional<integer>
location: optional<SearchRequestFilterLocation>
source:
openapi: ../openapi.yml
SearchRequestSort:
enum:
- asc
- desc
source:
openapi: ../openapi.yml
SearchResponse:
properties:
results: optional<list<string>>
source:
openapi: ../openapi.yml
service:
auth: false
base-path: ''
endpoints:
search:
path: /search
method: GET
auth: false
source:
openapi: ../openapi.yml
request:
name: SearchRequest
query-parameters:
filter: optional<SearchRequestFilter>
sort: optional<SearchRequestSort>
limit: optional<integer>
tags:
type: optional<string>
allow-multiple: true
response:
docs: Successful response
type: SearchResponse
examples:
- response:
body:
results:
- results
source:
openapi: ../openapi.yml
",
},
},
"packageMarkers": {},
"rootApiFile": {
"contents": {
"display-name": "Query Parameters API",
"error-discrimination": {
"strategy": "status-code",
},
"name": "api",
},
"defaultUrl": undefined,
"rawContents": "name: api
error-discrimination:
strategy: status-code
display-name: Query Parameters API
",
},
}
Loading

0 comments on commit 9debc6b

Please sign in to comment.