-
Notifications
You must be signed in to change notification settings - Fork 551
Improve Dataverse REST OpenAPI source annotations #12439
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
beepsoft
wants to merge
7
commits into
IQSS:develop
Choose a base branch
from
beepsoft:openapi-improvements
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,249
−623
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
985b349
Improve Dataverse REST OpenAPI source annotations
beepsoft 1a405ab
Configure OpenAPI post-processing filter
beepsoft 17807d1
Improve OpenAPI annotation coverage for vacuum conformance
beepsoft 61ba1d2
Merge remote-tracking branch 'iqss/develop' into openapi-improvements
beepsoft 9eaa716
Centralize OpenAPI API-key security
beepsoft 844294b
Merge branch 'develop' into openapi-improvements
pdurbin 5e7dfd9
Merge branch 'develop' into openapi-improvements
pdurbin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # OpenAPI Quality Checks | ||
|
|
||
| This directory contains the Dataverse vacuum ruleset used to check the generated | ||
| OpenAPI document while preserving known legacy API shapes. | ||
|
|
||
| ## vacuum | ||
|
|
||
| vacuum is a command-line linter and quality checker for OpenAPI, AsyncAPI, and | ||
| JSON Schema documents. It is compatible with Spectral rulesets, so the Dataverse | ||
| ruleset can extend the built-in `vacuum:oas` recommended profile and disable | ||
| rules that are noisy for the current API surface. | ||
|
|
||
| Project and documentation: | ||
|
|
||
| - GitHub: https://github.com/daveshanley/vacuum | ||
| - Docs: https://quobix.com/vacuum | ||
|
|
||
| Install with Homebrew: | ||
|
|
||
| ```bash | ||
| brew install --cask daveshanley/vacuum/vacuum | ||
| ``` | ||
|
|
||
| Install with npm: | ||
|
|
||
| ```bash | ||
| npm i -g @quobix/vacuum | ||
| ``` | ||
|
|
||
| Install with curl: | ||
|
|
||
| ```bash | ||
| curl -fsSL https://quobix.com/scripts/install_vacuum.sh | sh | ||
| ``` | ||
|
|
||
| ## Checking Dataverse OpenAPI | ||
|
|
||
| Generate the OpenAPI document from the repository root: | ||
|
|
||
| ```bash | ||
| mvn -q -DskipTests process-classes | ||
| ``` | ||
|
|
||
| The generated JSON is written to: | ||
|
|
||
| ```text | ||
| target/classes/META-INF/openapi.json | ||
| ``` | ||
|
|
||
| Run the vacuum checks from the repository root: | ||
|
|
||
| ```bash | ||
| vacuum lint -r scripts/openapi/vacuum-recommended.yaml target/classes/META-INF/openapi.json | ||
| ``` | ||
|
|
||
| For a fuller report: | ||
|
|
||
| ```bash | ||
| vacuum report -r scripts/openapi/vacuum-recommended.yaml target/classes/META-INF/openapi.json | ||
| ``` | ||
|
|
||
| For the interactive dashboard: | ||
|
|
||
| ```bash | ||
| vacuum dashboard -r scripts/openapi/vacuum-recommended.yaml target/classes/META-INF/openapi.json | ||
| ``` | ||
|
|
||
| The ruleset extends `vacuum:oas` recommended rules, with legacy/noisy checks | ||
| disabled where Dataverse intentionally keeps historical endpoint names or lacks | ||
| examples. Request-body findings remain enabled so unused body parameters on GET | ||
| endpoints are reported and can be removed from source. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| description: Dataverse OpenAPI recommended rules with legacy/noisy rules disabled. | ||
| extends: [[vacuum:oas, recommended]] | ||
| rules: | ||
| # Endpoint paths are historically camel case, and we won't change those for OpenAPI conformance | ||
| paths-kebab-case: false | ||
| # We do have duplications, because the same parameters as `id` will be used in multiple endpoints | ||
| description-duplication: false | ||
| # We don't have examples | ||
| oas3-missing-example: false | ||
| # We have /pids/{id}/delete --> see edu.harvard.iq.dataverse.api.Pids#deletePid | ||
| # The HTTP verb there is DELETE so actually we don't need to have the verb in the path, | ||
| # could be fixed | ||
| no-http-verbs-in-path: false | ||
| # These endpoints have an unused `body` parameter, probably because of copy-paste. | ||
| # no-request-body: false would not report them, but rather we should fix them to remove `body` | ||
| # GET /files/{id}/prov-freeform | ||
| # GET /files/{id}/prov-json | ||
| # GET /files/{id}/prov-json | ||
| #no-request-body: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@beepsoft I'm just putting this at the bottom because I hope we can simply resolve this comment in the future. https://github.com/IQSS/dataverse/actions/runs/28597534136 failed. Do you know why? I'm re-running it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what I should look for. After some digging I only see this one failure:
Should we focus on this one?