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

[BUG]Default Parameter Values Missing in Latest OpenAPI Specification #242

Closed
saimedhi opened this issue Apr 15, 2024 · 3 comments · Fixed by #249
Closed

[BUG]Default Parameter Values Missing in Latest OpenAPI Specification #242

saimedhi opened this issue Apr 15, 2024 · 3 comments · Fixed by #249
Assignees
Labels
bug Something isn't working

Comments

@saimedhi
Copy link
Contributor

What is the bug?

The latest OpenAPI specification lacks default parameter values.

What is the expected behavior?

Previous versions of the specification included default values for parameters in the schema.

Example: https://github.com/opensearch-project/opensearch-api-specification/blob/a44e6d92c006f1c03451a306a9e578f7ca48a862/OpenSearch.openapi.json#L485

@saimedhi saimedhi added bug Something isn't working untriaged labels Apr 15, 2024
@dblock
Copy link
Member

dblock commented Apr 15, 2024

@nhtruong or @saimedhi one of you should take it

@saimedhi
Copy link
Contributor Author

@nhtruong or @saimedhi one of you should take it

nhtruong is working on this.

@nhtruong
Copy link
Collaborator

nhtruong commented Apr 16, 2024

So this is what happened:

  • The Smithy models were generated from the legacy rest-api-spec. While working on this, I noticed that many of the default values were hidden in the param descriptions in the rest-api-spec. So, I extracted them and put them in the Smithy models, which later became schemas in OpenAPI.
  • When migrating this repo to native-OpenAPI, I also added the request and response bodies from ElasticSearch's OpenAPI spec into OpenSearch's, and replaced the OS parameter schemas with ES parameter schemas as well for 3 reasons:
    • Said schemas were also being used in the request/response bodies
    • The ES schemas also had higher resolutions

That's why those default values got lost during the translation. I'm going to compare the 2 sets of schemas to find the missing defaults. One thing to keep in mind: OpenAPI does not natively support default property inside a Parameter Object. That is, parameters pointing to the same schema cannot have their own default values but rather a shared default value via the shared schema. I've seen virtually identical parameters that only differ in the default values before. So, we will have to introduce another extension, x-default, for parameter objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants