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

OpenAPI Common Parameters #479

Merged
merged 21 commits into from
Feb 4, 2024

Conversation

reuvenharrison
Copy link
Collaborator

@reuvenharrison reuvenharrison commented Jan 30, 2024

Improve handling of Common Parameters

Common Parameters definition in OpenAPI spec:
Common Parameters for All Methods of a Path
Parameters shared by all operations of a path can be defined on the path level instead of the operation level. Path-level parameters are inherited by all operations of that path. A typical use case are the GET/PUT/PATCH/DELETE operations that manipulate a resource accessed via a path parameter.

This PR improves the results of: diff, breaking changes, and changelog with regards to common parameters.
Prior to the PR, common parameters were considered separately from the operation parameters.
After this PR, common parameters will be moved from the path and combined with operation parameters before running the diff.
As a result, the existing logic for operation parameters (diff, breaking changes, changelog etc.) will also be applied to common parameters.

New --flatten-params can be used with diff, breaking, changelog, delta and summary commands:

oasdiff changelog data/path-params/params_in_path.yaml data/path-params/params_in_op.yaml --flatten-params

For conformance, I'm also renaming the flatten flag as flatten-allof.
The old flatten flag will still be supported but will be hidden.

@reuvenharrison reuvenharrison linked an issue Jan 30, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2024

Codecov Report

Attention: 48 lines in your changes are missing coverage. Please review.

Comparison is base (a2470e3) 83.75% compared to head (5283b5c) 83.96%.
Report is 5 commits behind head on main.

Files Patch % Lines
internal/diff_flags.go 63.63% 16 Missing ⚠️
delta/endpoints.go 79.31% 4 Missing and 2 partials ⚠️
load/spec_info.go 76.92% 4 Missing and 2 partials ⚠️
internal/cmd_flags.go 88.57% 3 Missing and 1 partial ⚠️
delta/parameters.go 90.62% 2 Missing and 1 partial ⚠️
delta/schema.go 57.14% 2 Missing and 1 partial ⚠️
internal/delta.go 88.88% 2 Missing and 1 partial ⚠️
load/option.go 86.95% 2 Missing and 1 partial ⚠️
internal/changelog_flags.go 95.45% 2 Missing ⚠️
delta/delta.go 95.00% 1 Missing ⚠️
... and 1 more

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   83.75%   83.96%   +0.21%     
==========================================
  Files         217      228      +11     
  Lines       12593    12899     +306     
==========================================
+ Hits        10547    10831     +284     
- Misses       1668     1688      +20     
- Partials      378      380       +2     
Flag Coverage Δ
unittests 83.96% <89.16%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@reuvenharrison reuvenharrison changed the title inherit params from path to operation OpenAPI Common Parameters Feb 1, 2024
@reuvenharrison reuvenharrison merged commit a3b4664 into main Feb 4, 2024
9 checks passed
@reuvenharrison reuvenharrison deleted the 470-compare-parameters-also-on-path-level branch February 4, 2024 10:03
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.

Compare Parameters also on path level
2 participants