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

feat: OpenAPI allow non-nominal cases in enum #2578

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

runtologist
Copy link
Member

@runtologist runtologist commented Jan 2, 2024

We used to collect the references of the child cases and fail in case we came across a case without a nominal ref. This is not needed to correctly generate the oneOf structure in the openapi document, but to include the children to the schemas. After the change, we simply skip cases without a nominal ref when collection children. This allows for schemas like Enum2(String, Int) to be turned into oneOf: [string, number] correctly. Obviously, there will be no child schemas in this case.

We used to collect the references of the child cases and fail in case we came across a case without a nominal ref. This is not needed to correctly generate the `pneOf` structure in the openapi document, but to include the children to the schemas. After the change, we simply skip cases without a nominal ref when collection children. This allows for schemas like `Enum2(String, Int)` to be turned into `oneOf: [string, int]` correctly. Obviously, there will be no child schemas in this case.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (badb929) 64.37% compared to head (bb77ad2) 64.40%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2578      +/-   ##
==========================================
+ Coverage   64.37%   64.40%   +0.03%     
==========================================
  Files         140      140              
  Lines        8315     8314       -1     
  Branches     1504     1504              
==========================================
+ Hits         5353     5355       +2     
+ Misses       2962     2959       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@987Nabil 987Nabil merged commit be67a7d into zio:main Jan 2, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants