You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The quality of the OpenAPI document has been greatly improved, increasing from 10/100 to 98/100 according [vacuum](https://quobix.com/vacuum/). See [the guides](https://dataverse-guide--12439.org.readthedocs.build/en/12439/api/getting-started.html#getting-the-openapi-document) and #12439.
4
+
5
+
## Updates for Developers
6
+
7
+
- If you are adding or updating Dataverse APIs you are now required to add OpenAPI annotations. See [the guides](https://dataverse-guide--12439.org.readthedocs.build/en/12439/developers/api-design.html#openapi) and #12439.
We are aware that our OpenAPI document is not perfect. You can find more information about validating the document under :ref:`openapi-dev` in the Developer Guide.
181
+
If you have feedback about the our OpenAPI document, please contact us through the usual channels under :ref:`getting-help-with-apis`.
182
+
183
+
You can find more information about validating the document under :ref:`openapi-dev` in the Developer Guide.
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/developers/api-design.rst
+29-3Lines changed: 29 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,39 @@ OpenAPI
14
14
15
15
As you add API endpoints, please be conscious that we are exposing these endpoints as an OpenAPI document at ``/openapi`` (e.g. http://localhost:8080/openapi ). See :ref:`openapi` in the API Guide for the user-facing documentation.
16
16
17
-
We've played around with validation tools such as https://quobix.com/vacuum/ and https://pb33f.io/doctor/ only to discover that our OpenAPI output is less than ideal, generating various warnings and errors.
17
+
OpenAPI Annotations
18
+
~~~~~~~~~~~~~~~~~~~
19
+
20
+
To keep our OpenAPI document at a reasonable quality, you must add annotations to API endpoints you are adding and editing. Here's an example:
21
+
22
+
.. code-block:: java
23
+
24
+
@POST
25
+
@AuthRequired
26
+
@Path("/")
27
+
@Operation(summary="Creates a license", description="Creates a license when the authenticated user is a superuser and returns the created license location.")
28
+
@APIResponse(responseCode="201", description="License created with a Location header pointing to the new license.")
@RequestBody(description="License definition to persist, including name, URI, active state, and sort order.",
31
+
content=@Content(mediaType="application/json",
32
+
schema=@Schema(type=SchemaType.OBJECT,
33
+
description="License definition accepted by the license administration API.")))
34
+
License license) {
35
+
...
36
+
}
37
+
38
+
If you are looking for a reference about the annotations used to generate the OpenAPI document, you can find it in the `MicroProfile OpenAPI Specification <https://download.eclipse.org/microprofile/microprofile-open-api-3.1/microprofile-openapi-spec-3.1.html#_detailed_usage_of_key_annotations>`_.
39
+
40
+
OpenAPI Quality
41
+
~~~~~~~~~~~~~~~
42
+
43
+
To use `vacuum <https://quobix.com/vacuum/>`_ with our recommended settings to check the quality of our OpenAPI document, see the :download:`README.md <../../../../scripts/openapi/README.md>` under ``scripts/openapi``.
18
44
19
45
You can prevent additional problems in our OpenAPI document by observing the following practices:
20
46
21
47
- When creating a method name within an API class, make it unique.
22
-
23
-
If you are looking for a reference about the annotations used to generate the OpenAPI document, you can find it in the `MicroProfile OpenAPI Specification <https://download.eclipse.org/microprofile/microprofile-open-api-3.1/microprofile-openapi-spec-3.1.html#_detailed_usage_of_key_annotations>`_.
48
+
- Check that HTTP GET and DELETE operations do not accept request bodies.
49
+
- Various notes under :download:`vacuum-recommended.yaml <../../../../scripts/openapi/vacuum-recommended.yaml>`.
0 commit comments