-
Notifications
You must be signed in to change notification settings - Fork 493
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 definition endpoint #10328
OpenAPI definition endpoint #10328
Conversation
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 assume docs are coming. Just a quick initial review. I'm excited that SmallRye is working to create the OpenAPI output!
src/main/resources/edu/harvard/iq/dataverse/openapi/dataverse_openapi.json
Outdated
Show resolved
Hide resolved
src/main/resources/edu/harvard/iq/dataverse/openapi/dataverse_openapi.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Philip Durbin <[email protected]>
Co-authored-by: Philip Durbin <[email protected]>
Co-authored-by: Philip Durbin <[email protected]>
This comment has been minimized.
This comment has been minimized.
5 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
A little more doc review.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 pushed a few commits and have a couple more comments.
import org.glassfish.jersey.media.multipart.FormDataBodyPart; | ||
import org.glassfish.jersey.media.multipart.FormDataParam; | ||
|
||
import com.mashape.unirest.request.body.MultipartBody; |
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 the one who added Unirest but it's one of the libraries I'm hoping we can remove some day in favor of using the Jakarta EE standard. Do we need it here? I see a possible solution at https://stackoverflow.com/questions/64079847/how-to-provide-swagger-annotation-for-multipartformdatainput-in-resteasy-with-qu/65339649#65339649 . Is it worth trying it here and other places in this PR where Unirest is being used?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
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.
Looks good now. API tests are passing. @JR-1991 did note the following...
I just went through the doc and ran a validation. These are the open points:
- multipart schema must be an object— All multipart bodies are currently typed as string. This can also be addressed in preprocessing prior to code generation.
- items attribute required for arrays in OpenAPI 3.0.X documents- Two array properties do not contain the items key. Also, easy to fix in pre-processing.
- duplicate-properties - hTTPUpload (HTTPUpload) will collide with httpUpload (HTTPUpload) [line 11325] when converted to field name- Also addressable in pre-processing.
... in Zulip at https://dataverse.zulipchat.com/#narrow/stream/379673-dev/topic/.2Fopenapi.20broken.20in.206.2E0/near/441630800 BUT my take is that he can live with these problems.
Also, I still think we might want to stop gitignoring the YAML so we always have a version in the guides but we can talk about this at tech hours some day. No need to hold this up.
Approved.
@pdurbin - I am totally fine with the current version. The problems are minor and easily addressable in a pre-processing step 🙌 |
* Plugin initial config * Initial changes to provide OpenAPI definition * Added integration test * Imports fix * Add patchnotes * Update the changelog * Update src/main/java/edu/harvard/iq/dataverse/api/Info.java Co-authored-by: Philip Durbin <[email protected]> * Update doc/release-notes/10236-openapi-definition-endpoint.md Co-authored-by: Philip Durbin <[email protected]> * Update doc/release-notes/10236-openapi-definition-endpoint.md Co-authored-by: Philip Durbin <[email protected]> * Add native API docs * Remove generated definitions * Add to gitignore generated openapi files * Updates to docs * Ignore files correction * Remove files created by the plugin * Changes to move the definition files to META-INF * Changes to move the definitions to WEB-INF * Changes to get the files from META-INF * Changed the phase of execution of the smallrye plugin * Changes of names to improve the generation of the spec * Add support for OpenAPI annotations and documents the version endpoint * Multipart Annotations * Typos correction * Changes for tags * Renaming of methods * Changes to the endpoint * Added test * Add test * Deleted extra import * Docs updated * openapi doc tweaks IQSS#9981 IQSS#10236 * improve release note IQSS#9981 IQSS#10236 * Remove old test and changes response to JSON * stub out guidance on openapi validation IQSS#9981 IQSS#10236 * add InfoIT to list of tests * use description of Dataverse from website * mention status codes in openapi doc * update api faq about changelog, link to breaking changes doc * typo * Change to OpenApi * Changes to docs * Name fix * Removing the multipart from unirest --------- Co-authored-by: Philip Durbin <[email protected]>
Congrats on merging this PR 👍
Or if the issues remaining are minor should the issues be closed as "won't resolve" ? |
@DS-INRA thanks, we've been talking about this in Zulip and we closed both issues as out of date now that the new SmallRye-based /openapi endpoint will be available in the next release. By the way, I love the issue triage you do for us. To encourage even more, I listed it as a way to contribute: https://dataverse-guide--10532.org.readthedocs.build/en/10532/contributor/index.html#issue-triage |
What this PR does / why we need it:
On Dataverse 6.0 Payara was updated and this caused the url
/openapi
to stop working and caused an exception on the server.This PR restores the functionality by adding a Servlet on /openapi.
We incorporated the SmallRye OpenAPI plugin on our POM (https://github.com/smallrye/smallrye-open-api/tree/main/tools/maven-plugin) which will generate files for YAML and JSON formats and deposit them on
edu/harvard/iq/dataverse/openapi/
these files will be provided by this endpoint depending on the format requested.Which issue(s) this PR closes:
Suggestions on how to test this:
There are additional changes to improve the quality of the OpenAPI document like changing duplicated names from Java classes.
Is there a release notes update needed for this change?:
Yes
on Apr 17 2024: Payara has fixed the original endpoint but it is generating a spec definition that still has errors due duplicated names. We did some testing and regardless of what is on the documentation, the server is not returning the provided files on the META-INF directory, we tested this on the application root META-INF and the currently used META-INF. At this point, we decided to use this solution that will override the original endpoint and server the generated files from the smallrye plugin.
Preview of docs: https://dataverse-guide--10328.org.readthedocs.build/en/10328/api/native-api.html#get-openapi-specification