Skip to content

Commit

Permalink
Merge pull request #580 from MikeEdgar/issue-574
Browse files Browse the repository at this point in the history
Replace JAX-RS references with Jakarta REST
  • Loading branch information
Azquelt authored Jan 18, 2024
2 parents e247292 + 1bce2c7 commit 31d08f2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* A set of annotations, many derived from Swagger Core library. OpenAPI annotations can be augmented with existing
* JAX-RS annotations in an application to produce a valid OpenAPI document.
* Jakarta REST annotations in an application to produce a valid OpenAPI document.
*
* Examples of annotations in this package include:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* The APIResponse annotation corresponds to the OpenAPI Response model object which describes a single response from an
* API Operation, including design-time, static links to operations based on the response.
* <p>
* When this annotation is applied to a JAX-RS method the response is added to the responses defined in the
* When this annotation is applied to a Jakarta REST method the response is added to the responses defined in the
* corresponding OpenAPI operation. If the operation already has a response with the specified responseCode the
* annotation on the method is ignored.
*
Expand All @@ -46,13 +46,13 @@
* }
* </pre>
* <p>
* When this annotation is applied to a JAX-RS resource class, the response is added to the responses defined in all
* When this annotation is applied to a Jakarta REST resource class, the response is added to the responses defined in all
* OpenAPI operations which correspond to a method on that class. If an operation already has a response with the
* specified responseCode the response is not added to that operation.
*
* <p>
* When this annotation is applied to an <code>ExceptionMapper</code> class or <code>toResponse</code> method, it allows
* developers to describe the API response that will be added to a generated OpenAPI operation based on a JAX-RS method
* developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST method
* that declares an <code>Exception</code> of the type handled by the <code>ExceptionMapper</code>.
*
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
* <ul>
* <li>If the method's return type is <code>void</code> and the HTTP method is <code>&#64;POST</code>, the code will
* be <code>201</code>.
* <li>Otherwise, if the method's return type is <code>void</code> the method does not list a JAX-RS
* <li>Otherwise, if the method's return type is <code>void</code> the method does not list a Jakarta REST
* <code>AsyncResponse</code> parameter, the code will be <code>204</code>.
* <li>Otherwise, the code will be <code>200</code>.
* </ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* A set of Java interfaces, annotations and programming models which allow Java developers to natively produce OpenAPI
* v3 documents from their JAX-RS applications.
* v3 documents from their Jakarta REST applications.
*/

@org.osgi.annotation.versioning.Version("2.1")
Expand Down
20 changes: 10 additions & 10 deletions spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ RESTful Services.
This MicroProfile specification, called OpenAPI, aims to provide a set of Java
interfaces and programming models which allow Java developers to natively produce
OpenAPI v3 documents from their applications written using Jakarta RESTful Web
Services (JAX-RS).
Services (Jakarta REST).

== Architecture

There are different ways to augment a JAX-RS application in order to produce an
There are different ways to augment a Jakarta REST application in order to produce an
OpenAPI document, which are described in <<Documentation Mechanisms>>. The picture
below provides a quick overview of the different types of components that make up
the MP OpenAPI specification:
Expand Down Expand Up @@ -177,18 +177,18 @@ There are many different ways to provide input for the generation of the resulti
OpenAPI document.

The MP OpenAPI specification requires vendors to produce a valid OpenAPI document
from pure JAX-RS applications. This means that vendors must process all the
relevant JAX-RS annotations (such as `@Path` and `@Consumes`) as well as Java objects
(POJOs) used as input or output to JAX-RS operations. This is a good place to
from pure Jakarta REST applications. This means that vendors must process all the
relevant Jakarta REST annotations (such as `@Path` and `@Consumes`) as well as Java objects
(POJOs) used as input or output to Jakarta REST operations. This is a good place to
start for application developers that are new to OpenAPI: just deploy your existing
JAX-RS application into a MP OpenAPI vendor and check out the output from `/openapi`!
Jakarta REST application into a MP OpenAPI vendor and check out the output from `/openapi`!

The application developer then has a few choices:

1. Augment those JAX-RS annotations with the
1. Augment those Jakarta REST annotations with the
OpenAPI <<Annotations>>. Using annotations means
developers don't have to re-write the portions of the OpenAPI document that are
already covered by the JAX-RS framework (e.g. the HTTP method of an operation).
already covered by the Jakarta REST framework (e.g. the HTTP method of an operation).

2. Take the initial output from `/openapi` as a starting point to document
your APIs via <<Static OpenAPI files>>. It's worth mentioning that these static
Expand Down Expand Up @@ -747,7 +747,7 @@ conflicts), or create a new model if an `OASModelReader` was not registered.
If found, it will read that document and merge with the model produced by previous
processing steps (if any), where conflicting elements from the static file will override
the values from the original model.
* If annotation scanning was not disabled, the JAX-RS and OpenAPI annotations from
* If annotation scanning was not disabled, the Jakarta REST and OpenAPI annotations from
the application will be processed, further overriding any conflicting elements
from the current model.
* The final model is filtered by walking the model tree and invoking all registered
Expand All @@ -763,7 +763,7 @@ following conditions are met:
- an `OASModelReader` has been configured with `mp.openapi.model.reader`
- an `OASFilter` has been configured with `mp.openapi.filter`
- one of the allowed static files is present, i.e. `META-INF/openapi.(json|yaml|yml)`
- the application uses JAX-RS
- the application uses Jakarta REST

For example, `GET http://myHost:myPort/openapi`.

Expand Down

0 comments on commit 31d08f2

Please sign in to comment.