Skip to content

explode defaults to true for query parameters #7148

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ogugu9
Copy link

@ogugu9 ogugu9 commented Apr 28, 2025

From #4167, the default value of explode in the query parameter has become false.

However, according to the OpenAPI v3 specification, the default value of explode in the query parameter is true.

Actually, the code comment says that For query parameters(style: form) the default is explode: true as opposed to the implementation.

if (httpProperty.options.explode !== true) {
// For query parameters(style: form) the default is explode: true https://spec.openapis.org/oas/v3.0.2#fixed-fields-9
attributes.explode = false;
}

Therefore, I changed the default value of explode to true in this PR.

@ogugu9 ogugu9 force-pushed the query-explode-default branch from 0e10183 to 5c43899 Compare April 28, 2025 11:36
@ogugu9
Copy link
Author

ogugu9 commented Apr 28, 2025

@microsoft-github-policy-service agree

@@ -1544,7 +1544,7 @@ function createOAPIEmitter(

if (httpProperty.options.explode !== true) {
// For query parameters(style: form) the default is explode: true https://spec.openapis.org/oas/v3.0.2#fixed-fields-9
attributes.explode = false;
attributes.explode = true;
Copy link
Member

Choose a reason for hiding this comment

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

Hi @ogugu9 thanks for the contribution,

can you clarify a bit more why this is needed. That pr you linked exactly fixed this issue where the explode value in openapi3 didn't match what we had in the typespec.

The value of explode should always be seens as the same it just happens that we have different defaults so we need to reflect that.

Can you show an example of your issue in the playground https://typespec.io/playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:openapi3 Issues for @typespec/openapi3 emitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants