Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] fix: support different query parameter encoding #1654

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion fern/apis/fdr/definition/api/latest/endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ types:
defaultEnvironment: optional<rootCommons.EnvironmentId>
environments: optional<list<commons.Environment>>
pathParameters: optional<list<type.ObjectProperty>>
queryParameters: optional<list<type.ObjectProperty>>
queryParameters: optional<list<QueryParameter>>
requestHeaders: optional<list<type.ObjectProperty>>
responseHeaders: optional<list<type.ObjectProperty>> # this is not being used currently
request: optional<HttpRequest>
Expand All @@ -37,6 +37,21 @@ types:
examples: optional<list<ExampleEndpointCall>>
snippetTemplates: optional<EndpointSnippetTemplates>

QueryParameter:
union:
commaSeparated:
type: type.ObjectProperty
docs: An array of query parameters that are serialized as a comma delimited list
exploded:
type: type.ObjectProperty
docs: An array of query parameters that are sent as individual params in the URL
deepObject:
type: type.ObjectProperty
docs: A query parameter that is an object with properties and serialized as `a[key1]=value1`
basic:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we

  • fall back to comma-separated if basic is an array?
  • fall back to deep object if basic is an object, or an array with objects?

type: type.ObjectProperty
docs: A basic primitive query parameter

EndpointSnippetTemplates:
properties:
typescript: optional<snippetTemplate.VersionedSnippetTemplate>
Expand Down
6 changes: 6 additions & 0 deletions fern/apis/fdr/definition/api/v1/read/endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ types:
properties:
key: string
type: type.TypeReference
arrayEncoding: optional<QueryParameterArrayEncoding>
Copy link
Contributor

@abvthecity abvthecity Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark this as default: comma? or do we treat everything as basic for now?


QueryParameterArrayEncoding:
enum:
- comma
- exploded

Header:
extends:
Expand Down
6 changes: 6 additions & 0 deletions fern/apis/fdr/definition/api/v1/register/endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ types:
properties:
key: string
type: type.TypeReference
arrayEncoding: optional<QueryParameterArrayEncoding>

QueryParameterArrayEncoding:
enum:
- comma
- exploded

Header:
extends:
Expand Down
Loading