From 3401f04f8d9e6ba3437000d2cfa1677f06a9ec05 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Mon, 3 Jul 2023 21:34:32 +0000 Subject: [PATCH 001/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 4695cc79..beb293c3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 7d9f5764..e20c5df0 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -56,7 +56,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1.1 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 6a7b9327..05d67944 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 2f85a244..c9b15c2a 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 9a616316..0927a091 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-tck From 5614b7c4b1fcab83fbdc5bd8b68d7908d43e5743 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Wed, 5 Jul 2023 11:50:06 +0000 Subject: [PATCH 002/121] [maven-release-plugin] prepare release 3.1.1 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index beb293c3..4695cc79 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 3.1.1 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index e20c5df0..7d9f5764 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 3.1.1 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -56,7 +56,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 3.1.1 diff --git a/spec/pom.xml b/spec/pom.xml index 05d67944..6a7b9327 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 3.1.1 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index c9b15c2a..2f85a244 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 3.1.1 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 0927a091..9a616316 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 3.1.1 microprofile-openapi-tck From 346acd81548c945d5aee544ddf0cada29bd993dd Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 10 Aug 2023 17:25:11 +0100 Subject: [PATCH 003/121] Extensions on methods don't cascade to responses There's nothing in the spec to specify that an @Extension annotation placed on a method should result in that extension key and value being added to the responses of the corresponding operation. Remove the test that was asserting this behaviour. --- .../org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 9b56df70..23b3bd94 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -291,7 +291,6 @@ public void testExtensionPlacement(String type) { vr.body(opPath + ".responses.'200'", not(hasKey(X_OPERATION_EXT))); vr.body(opPath + ".responses.'200'", hasEntry(equalTo("x-response-ext"), equalTo("test-response-ext"))); vr.body(opPath + ".responses.'500'", not(hasKey(X_OPERATION_EXT))); - vr.body(opPath + ".responses.'503'", hasEntry(equalTo(X_OPERATION_EXT), equalTo(TEST_OPERATION_EXT))); vr.body(opPath + ".responses.'503'.content.'application/json'", hasEntry(equalTo("x-notavailable-ext"), equalTo("true"))); vr.body(opPath + ".responses.'503'.content.'application/xml'", From 33a7a83065d28e5c4ea7b75fa4311af51dee6700 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 9 Jan 2024 08:44:19 -0500 Subject: [PATCH 004/121] Revert "[maven-release-plugin] prepare release 3.1.1" (#575) This reverts commit 5614b7c4b1fcab83fbdc5bd8b68d7908d43e5743. --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 4695cc79..beb293c3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 7d9f5764..e20c5df0 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -56,7 +56,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1.1 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 6a7b9327..05d67944 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 2f85a244..c9b15c2a 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 9a616316..0927a091 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.1.1 + 3.2-SNAPSHOT microprofile-openapi-tck From 8f0fd47721fb8b39cf8eab614291f11bb5b95bda Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 9 Jan 2024 12:35:16 -0500 Subject: [PATCH 005/121] Update parent, add module-info, streamline OSGi annotation dependency Signed-off-by: Michael Edgar --- api/pom.xml | 22 +++++++++++-- api/src/main/java/module-info.java | 53 ++++++++++++++++++++++++++++++ pom.xml | 16 +++------ spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 api/src/main/java/module-info.java diff --git a/api/pom.xml b/api/pom.xml index beb293c3..bf7ed935 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -28,10 +28,26 @@ MicroProfile OpenAPI API :: API - - biz.aQute.bnd - biz.aQute.bnd.annotation + + org.osgi + osgi.annotation + provided + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.2.1 + + + **/module-info.java + + + + + diff --git a/api/src/main/java/module-info.java b/api/src/main/java/module-info.java new file mode 100644 index 00000000..e107c72c --- /dev/null +++ b/api/src/main/java/module-info.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * Eclipse MicroProfile OpenAPI + *

+ * A set of Java interfaces, annotations, and programming models which allow Java developers to natively produce OpenAPI + * documents from Jakarta RESTful Web Services applications. + */ +module org.eclipse.microprofile.openapi { + + exports org.eclipse.microprofile.openapi; + exports org.eclipse.microprofile.openapi.annotations; + exports org.eclipse.microprofile.openapi.annotations.callbacks; + exports org.eclipse.microprofile.openapi.annotations.enums; + exports org.eclipse.microprofile.openapi.annotations.extensions; + exports org.eclipse.microprofile.openapi.annotations.headers; + exports org.eclipse.microprofile.openapi.annotations.info; + exports org.eclipse.microprofile.openapi.annotations.links; + exports org.eclipse.microprofile.openapi.annotations.media; + exports org.eclipse.microprofile.openapi.annotations.parameters; + exports org.eclipse.microprofile.openapi.annotations.responses; + exports org.eclipse.microprofile.openapi.annotations.security; + exports org.eclipse.microprofile.openapi.annotations.servers; + exports org.eclipse.microprofile.openapi.annotations.tags; + exports org.eclipse.microprofile.openapi.models; + exports org.eclipse.microprofile.openapi.models.callbacks; + exports org.eclipse.microprofile.openapi.models.examples; + exports org.eclipse.microprofile.openapi.models.headers; + exports org.eclipse.microprofile.openapi.models.info; + exports org.eclipse.microprofile.openapi.models.links; + exports org.eclipse.microprofile.openapi.models.media; + exports org.eclipse.microprofile.openapi.models.parameters; + exports org.eclipse.microprofile.openapi.models.responses; + exports org.eclipse.microprofile.openapi.models.security; + exports org.eclipse.microprofile.openapi.models.servers; + exports org.eclipse.microprofile.openapi.models.tags; + exports org.eclipse.microprofile.openapi.spi; + + // Required for compilation, not used at runtime + requires static osgi.annotation; + +} diff --git a/pom.xml b/pom.xml index e20c5df0..98879708 100644 --- a/pom.xml +++ b/pom.xml @@ -19,8 +19,9 @@ org.eclipse.microprofile microprofile-parent - 2.7 + 3.2 + org.eclipse.microprofile.openapi microprofile-openapi-parent 3.2-SNAPSHOT @@ -30,7 +31,7 @@ 2017 - 1.1.1 + 8.1.0 4.3.0 2.0.0.0 @@ -39,8 +40,7 @@ 3.0.1 3.0.1 3.0.2 - 5.3.0 - 2.6 + 3.2 @@ -66,15 +66,9 @@ - - biz.aQute.bnd - biz.aQute.bnd.annotation - ${biz.aQute.bnd.version} - provided - org.osgi - org.osgi.annotation.versioning + osgi.annotation ${osgi-annotation.version} provided diff --git a/spi/pom.xml b/spi/pom.xml index c9b15c2a..c9e7e865 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -30,7 +30,7 @@ org.osgi - org.osgi.annotation.versioning + osgi.annotation org.eclipse.microprofile.openapi diff --git a/tck/pom.xml b/tck/pom.xml index 0927a091..85370aba 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -42,7 +42,7 @@ org.osgi - org.osgi.annotation.versioning + osgi.annotation From 1bce2c7ae26ed9cd7abe195ba32f3f655abad69b Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 9 Jan 2024 12:40:20 -0500 Subject: [PATCH 006/121] Replace JAX-RS references with Jakarta REST Signed-off-by: Michael Edgar --- .../openapi/annotations/package-info.java | 2 +- .../annotations/responses/APIResponse.java | 6 +++--- .../responses/APIResponseSchema.java | 2 +- .../microprofile/openapi/package-info.java | 2 +- .../microprofile-openapi-spec.asciidoc | 20 +++++++++---------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java index 1723d696..8963a720 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java @@ -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: *

    diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index 9f75ef50..bd65ccfd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -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. *

    - * 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. * @@ -46,13 +46,13 @@ * } * *

    - * 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. * *

    * When this annotation is applied to an ExceptionMapper class or toResponse 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 Exception of the type handled by the ExceptionMapper. * *

    diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java
    index 1a9a3b3f..0a2f5642 100644
    --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java
    +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java
    @@ -95,7 +95,7 @@
          * 
      *
    • If the method's return type is void and the HTTP method is @POST, the code will * be 201. - *
    • Otherwise, if the method's return type is void the method does not list a JAX-RS + *
    • Otherwise, if the method's return type is void the method does not list a Jakarta REST * AsyncResponse parameter, the code will be 204. *
    • Otherwise, the code will be 200. *
    diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java index a745ada3..6684dbd8 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java @@ -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") diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index a8fa8f19..52d67116 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -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 <>. The picture below provides a quick overview of the different types of components that make up the MP OpenAPI specification: @@ -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 <>. 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 <>. It's worth mentioning that these static @@ -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 @@ -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`. From 7c5bacfac4393ba61ba69451737e8a86b45bb411 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 9 Jan 2024 12:41:48 -0500 Subject: [PATCH 007/121] Add missing comma to `mp.openapi.schema.` configuration example Signed-off-by: Michael Edgar --- spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index a8fa8f19..4bb0bf8d 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -159,7 +159,7 @@ escapes and indentation added for readability): [source, json] ---- mp.openapi.schema.java.util.Date = { \ - "name": "EpochMillis" \ + "name": "EpochMillis", \ "type": "number", \ "format": "int64", \ "description": "Milliseconds since January 1, 1970, 00:00:00 GMT" \ From 185f2bff3b10823af7f079c7e486c1ea959f0270 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 9 Jan 2024 12:45:12 -0500 Subject: [PATCH 008/121] Remove the day of week from the weekly meeting schedule Signed-off-by: Michael Edgar --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 9140d392..5333be49 100644 --- a/README.adoc +++ b/README.adoc @@ -40,7 +40,7 @@ Do you want to contribute to this project? Here is what you can do: ** Make sure you have signed the https://www.eclipse.org/legal/ECA.php[Eclipse Contributor Agreement] * https://github.com/eclipse/microprofile-open-api/issues[Create or fix an issue]. * https://gitter.im/eclipse/microprofile-open-api[Join us on Gitter to discuss this project]. -* Join our weekly meeting (https://calendar.google.com/calendar/u/0/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com&ctz=UTC[UTC] / https://calendar.google.com/calendar/u/0/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com&ctz=America/New_York[US Eastern time]) every Monday. +* Join our weekly meeting (https://calendar.google.com/calendar/u/0/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com&ctz=UTC[UTC] / https://calendar.google.com/calendar/u/0/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com&ctz=America/New_York[US Eastern time]). ** https://docs.google.com/document/d/1lwrGcNTGnML4Aof0FyGVZCPaaNDBOoKLa5jivlVY1D8/edit?usp=sharing[Minutes and Agenda]. * Join the discussions on the https://groups.google.com/forum/#!forum/microprofile[MicroProfile Google Group] * https://microprofile.io/blog/[Contribute a blog post]. From 8bb9a44889977304ce2d7f7a1da621040b7daf7a Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Wed, 17 Jan 2024 07:29:53 -0500 Subject: [PATCH 009/121] Deprecate `spi` module and contents Signed-off-by: Michael Edgar --- api/pom.xml | 2 +- .../openapi/annotations/responses/APIResponse.java | 8 ++++---- spi/pom.xml | 10 +++++++--- .../microprofile/openapi/spi/OASFactoryResolver.java | 4 ++++ .../eclipse/microprofile/openapi/spi/package-info.java | 8 ++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index bf7ed935..466875d4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -25,7 +25,7 @@ microprofile-openapi-api MicroProfile OpenAPI API - MicroProfile OpenAPI API :: API + MicroProfile OpenAPI :: API diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index bd65ccfd..6f666036 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -46,14 +46,14 @@ * } *
    *

    - * 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 + * 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. * *

    * When this annotation is applied to an ExceptionMapper class or toResponse method, it allows - * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST method - * that declares an Exception of the type handled by the ExceptionMapper. + * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST + * method that declares an Exception of the type handled by the ExceptionMapper. * *

      * @Provider
    diff --git a/spi/pom.xml b/spi/pom.xml
    index c9e7e865..8ab4eeaa 100644
    --- a/spi/pom.xml
    +++ b/spi/pom.xml
    @@ -25,7 +25,13 @@
     
         microprofile-openapi-spi
         MicroProfile OpenAPI SPI
    -    MicroProfile OpenAPI SPI :: SPI
    +    
    +        MicroProfile OpenAPI :: SPI
    +
    +        This module is deprecated and will be removed in a future release of MicroProfile
    +        OpenAPI. The functionality offered by this module is available in the microprofile-openapi-api
    +        module which should be used instead.
    +    
     
         
             
    @@ -37,6 +43,4 @@
                 microprofile-openapi-api
             
         
    -
    -    
     
    diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    index bef662e5..c67414f3 100644
    --- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    +++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    @@ -31,7 +31,11 @@
      * Service provider for OASFactoryResolver. The implementation registers itself via the {@link java.util.ServiceLoader}
      * mechanism or by manually setting their implementation using the setInstance method.
      *
    + * @deprecated the OASFactoryResolver available in module
    + *             {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version
    + *             which will be removed in a future major release.
      */
    +@Deprecated(forRemoval = true)
     public abstract class OASFactoryResolver {
     
         private static volatile OASFactoryResolver instance = null;
    diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    index 01cc8df4..2560ea61 100644
    --- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    +++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    @@ -13,7 +13,11 @@
     
     /**
      * Service provider interface which allows vendors to set their implementations of OASFactoryResolver.
    + * 

    + * The {@code org.eclipse.microprofile.openapi.spi} package available in module + * {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version which will + * be removed in a future major release. */ - +@Deprecated(forRemoval = true) @org.osgi.annotation.versioning.Version("1.0") -package org.eclipse.microprofile.openapi.spi; \ No newline at end of file +package org.eclipse.microprofile.openapi.spi; From c9a166100761ceda9dcaee258cd0a14d0a39b41b Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Fri, 19 Jan 2024 17:57:51 -0500 Subject: [PATCH 010/121] Revert "Deprecate `spi` module and contents" This reverts commit 8bb9a44889977304ce2d7f7a1da621040b7daf7a. --- api/pom.xml | 2 +- .../openapi/annotations/responses/APIResponse.java | 8 ++++---- spi/pom.xml | 10 +++------- .../microprofile/openapi/spi/OASFactoryResolver.java | 4 ---- .../eclipse/microprofile/openapi/spi/package-info.java | 8 ++------ 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 466875d4..bf7ed935 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -25,7 +25,7 @@ microprofile-openapi-api MicroProfile OpenAPI API - MicroProfile OpenAPI :: API + MicroProfile OpenAPI API :: API diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index 6f666036..bd65ccfd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -46,14 +46,14 @@ * } *

    *

    - * 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 + * 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. * *

    * When this annotation is applied to an ExceptionMapper class or toResponse method, it allows - * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST - * method that declares an Exception of the type handled by the ExceptionMapper. + * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST method + * that declares an Exception of the type handled by the ExceptionMapper. * *

      * @Provider
    diff --git a/spi/pom.xml b/spi/pom.xml
    index 8ab4eeaa..c9e7e865 100644
    --- a/spi/pom.xml
    +++ b/spi/pom.xml
    @@ -25,13 +25,7 @@
     
         microprofile-openapi-spi
         MicroProfile OpenAPI SPI
    -    
    -        MicroProfile OpenAPI :: SPI
    -
    -        This module is deprecated and will be removed in a future release of MicroProfile
    -        OpenAPI. The functionality offered by this module is available in the microprofile-openapi-api
    -        module which should be used instead.
    -    
    +    MicroProfile OpenAPI SPI :: SPI
     
         
             
    @@ -43,4 +37,6 @@
                 microprofile-openapi-api
             
         
    +
    +    
     
    diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    index c67414f3..bef662e5 100644
    --- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    +++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/OASFactoryResolver.java
    @@ -31,11 +31,7 @@
      * Service provider for OASFactoryResolver. The implementation registers itself via the {@link java.util.ServiceLoader}
      * mechanism or by manually setting their implementation using the setInstance method.
      *
    - * @deprecated the OASFactoryResolver available in module
    - *             {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version
    - *             which will be removed in a future major release.
      */
    -@Deprecated(forRemoval = true)
     public abstract class OASFactoryResolver {
     
         private static volatile OASFactoryResolver instance = null;
    diff --git a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    index 2560ea61..01cc8df4 100644
    --- a/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    +++ b/spi/src/main/java/org/eclipse/microprofile/openapi/spi/package-info.java
    @@ -13,11 +13,7 @@
     
     /**
      * Service provider interface which allows vendors to set their implementations of OASFactoryResolver.
    - * 

    - * The {@code org.eclipse.microprofile.openapi.spi} package available in module - * {@code org.eclipse.microprofile.openapi:microprofile-openapi-api} should be used instead of this version which will - * be removed in a future major release. */ -@Deprecated(forRemoval = true) + @org.osgi.annotation.versioning.Version("1.0") -package org.eclipse.microprofile.openapi.spi; +package org.eclipse.microprofile.openapi.spi; \ No newline at end of file From 8545f2fd507b28aee2b74074d9329359f58a351c Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 23 Jan 2024 14:48:02 -0500 Subject: [PATCH 011/121] Declare use of OASFactoryResolver in module-info Signed-off-by: Michael Edgar --- api/pom.xml | 2 +- api/src/main/java/module-info.java | 3 +++ .../openapi/annotations/responses/APIResponse.java | 8 ++++---- spi/pom.xml | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index bf7ed935..466875d4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -25,7 +25,7 @@ microprofile-openapi-api MicroProfile OpenAPI API - MicroProfile OpenAPI API :: API + MicroProfile OpenAPI :: API diff --git a/api/src/main/java/module-info.java b/api/src/main/java/module-info.java index e107c72c..cf6617b9 100644 --- a/api/src/main/java/module-info.java +++ b/api/src/main/java/module-info.java @@ -17,6 +17,7 @@ * A set of Java interfaces, annotations, and programming models which allow Java developers to natively produce OpenAPI * documents from Jakarta RESTful Web Services applications. */ +@SuppressWarnings("module") // silence warning about unstable name `osgi.annotation` module org.eclipse.microprofile.openapi { exports org.eclipse.microprofile.openapi; @@ -47,6 +48,8 @@ exports org.eclipse.microprofile.openapi.models.tags; exports org.eclipse.microprofile.openapi.spi; + uses org.eclipse.microprofile.openapi.spi.OASFactoryResolver; + // Required for compilation, not used at runtime requires static osgi.annotation; diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index bd65ccfd..6f666036 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -46,14 +46,14 @@ * } *

    *

    - * 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 + * 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. * *

    * When this annotation is applied to an ExceptionMapper class or toResponse method, it allows - * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST method - * that declares an Exception of the type handled by the ExceptionMapper. + * developers to describe the API response that will be added to a generated OpenAPI operation based on a Jakarta REST + * method that declares an Exception of the type handled by the ExceptionMapper. * *

      * @Provider
    diff --git a/spi/pom.xml b/spi/pom.xml
    index c9e7e865..3d7f7a15 100644
    --- a/spi/pom.xml
    +++ b/spi/pom.xml
    @@ -25,7 +25,7 @@
     
         microprofile-openapi-spi
         MicroProfile OpenAPI SPI
    -    MicroProfile OpenAPI SPI :: SPI
    +    MicroProfile OpenAPI :: SPI
     
         
             
    @@ -38,5 +38,5 @@
             
         
     
    -    
    +
     
    
    From 0cb221a37fb2c0fc5ea8e4636b9e83ffc68f9f26 Mon Sep 17 00:00:00 2001
    From: Andrew Rouse 
    Date: Wed, 24 Jan 2024 13:36:25 +0000
    Subject: [PATCH 012/121] Validate formatting in CI build
    
    Add a profile to validate code formatting
    
    Use this profile in the github build action
    
    Currently, the build will autoformat the code. This change will ensure
    that code can't be merged if it wasn't formatted before it was
    committed.
    ---
     .github/workflows/build.yml |  2 +-
     pom.xml                     | 21 +++++++++++++++++++++
     2 files changed, 22 insertions(+), 1 deletion(-)
    
    diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
    index f4059d83..e547c8d4 100644
    --- a/.github/workflows/build.yml
    +++ b/.github/workflows/build.yml
    @@ -23,4 +23,4 @@ jobs:
               cache: 'maven'
     
           - name: build with maven
    -        run: mvn -B --no-transfer-progress verify javadoc:javadoc --file pom.xml
    +        run: mvn -B --no-transfer-progress verify javadoc:javadoc --file pom.xml -Pvalidate-formatting
    diff --git a/pom.xml b/pom.xml
    index e20c5df0..7ddde83b 100644
    --- a/pom.xml
    +++ b/pom.xml
    @@ -93,4 +93,25 @@
             spi
         
     
    +    
    +        
    +            validate-formatting
    +            
    +                
    +                    
    +                        net.revelc.code.formatter
    +                        formatter-maven-plugin
    +                        
    +                            
    +                            
    +                                validate
    +                            
    +                            
    +                        
    +                    
    +                
    +            
    +        
    +    
    +
     
    
    From 0d8991d921e199826102c9d9c556527e6bcbed56 Mon Sep 17 00:00:00 2001
    From: Jakub Pomykala 
    Date: Mon, 12 Feb 2024 13:55:36 +0000
    Subject: [PATCH 013/121] Removing p tags to fix doclint check
    
    - With these tags in place the doclint check fails and causing a build failure for the javadocs
    ---
     .../java/org/eclipse/microprofile/openapi/models/media/XML.java | 2 --
     1 file changed, 2 deletions(-)
    
    diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java
    index 1f0db090..2b9fafd4 100644
    --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java
    +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java
    @@ -23,10 +23,8 @@
     /**
      * A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are not
      * inferred (for singular/plural forms) and the name property SHOULD be used to add that information.
    - * 

    * * @see XML Object - *

    */ public interface XML extends Constructible, Extensible { From d621c79f2441c13e13be7c03c14a1e19d787197e Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 18 Mar 2024 17:40:20 +0000 Subject: [PATCH 014/121] Use the 2.8 microprofile-parent but target Java 11 Ensures that the TCK uses dependencies from Jakarta EE 9.1. Keep the tck-bom at 3.2 since the only differences are to use newer versions of libraries which don't support Java 8. --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 236e478a..84e67b00 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 3.2 + 2.8 org.eclipse.microprofile.openapi @@ -31,6 +31,7 @@ 2017 + 11 8.1.0 4.3.0 @@ -40,6 +41,7 @@ 3.0.1 3.0.1 3.0.2 + 3.2 From aa5e727a8a6db526d583d1c93549586a4604b93c Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 26 Jan 2024 16:57:49 +0000 Subject: [PATCH 015/121] Schema model: add new properties - if/then/else - $dialect - comment - depedentSchemas - prefixItems - contains - patternProperties - propertyNames - unevaluatedItems - unevaluatedProperties - const - maxContains - minContains - dependentRequired - contentEncoding - contentMediaType - contentSchema Co-authored-by: Michael Edgar --- api/pom.xml | 2 +- .../openapi/models/media/Schema.java | 757 ++++++++++++++++++ .../openapi/models/media/package-info.java | 2 +- pom.xml | 2 +- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 7 files changed, 763 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 466875d4..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 7af94377..9cb8582d 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -1192,4 +1192,761 @@ default Schema oneOf(List oneOf) { */ void removeOneOf(Schema oneOf); + /** + * Returns the schema dialect in use. This is the value of the {@code $schema} property. + * + * @return the schema dialect name, or {@code null} for the default + * @since 4.0 + */ + String getSchemaDialect(); + + /** + * Sets the schema dialect in use. This is the value of the {@code $schema} property. + * + * @param schemaDialect + * the schema dialect name, or {@code null} for the default + * @since 4.0 + */ + void setSchemaDialect(String schemaDialect); + + /** + * Sets the schema dialect in use. This is the value of the {@code $schema} property. + * + * @param schemaDialect + * the schema dialect name, or {@code null} for the default + * @return the current Schema instance + * @since 4.0 + */ + default Schema schemaDialect(String schemaDialect) { + setSchemaDialect(schemaDialect); + return this; + } + + /** + * Returns the comment to be included in the {@code $comment} property of the schema. + * + * @return the comment, or {@code null} if no comment is set + * @since 4.0 + */ + String getComment(); + + /** + * Sets the comment to be included in the {@code $comment} property of the schema. + * + * @param comment + * the comment, or {@code null} to remove any comment + * @since 4.0 + */ + void setComment(String comment); + + /** + * Sets the comment to be included in the {@code $comment} property of the schema. + * + * @param comment + * the comment, or {@code null} to remove any comment + * @return the current Schema instance + * @since 4.0 + */ + default Schema comment(String comment) { + setComment(comment); + return this; + } + + /** + * Returns the "if" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema, otherwise it must be valid against the "else" schema. + * + * @return the if schema + * @since 4.0 + */ + Schema getIfSchema(); + + /** + * Sets the "if" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema, otherwise it must be valid against the "else" schema. + * + * @param ifSchema + * the if schema + * @since 4.0 + */ + void setIfSchema(Schema ifSchema); + + /** + * Sets the "if" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema, otherwise it must be valid against the "else" schema. + * + * @param ifSchema + * the if schema + * @return the current Schema instance + * @since 4.0 + */ + default Schema ifSchema(Schema ifSchema) { + setIfSchema(ifSchema); + return this; + } + + /** + * Returns the "then" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema. + * + * @return the then schema + * @since 4.0 + */ + Schema getThenSchema(); + + /** + * Sets the "then" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema. + * + * @param thenSchema + * the then schema + * @since 4.0 + */ + void setThenSchema(Schema thenSchema); + + /** + * Sets the "then" schema. If an object is valid against the "if" schema, then it must also be valid against the + * "then" schema. + * + * @param thenSchema + * the then schema + * @return the current Schema instance + * @since 4.0 + */ + default Schema thenSchema(Schema thenSchema) { + setThenSchema(thenSchema); + return this; + } + + /** + * Returns the "else" schema. If an object is not valid against the "if" schema, then it must be valid against the + * "else" schema. + * + * @return the else schema + * @since 4.0 + */ + Schema getElseSchema(); + + /** + * Sets the "else" schema. If an object is not valid against the "if" schema, then it must be valid against the + * "else" schema. + * + * @param elseSchema + * the else schema + * @since 4.0 + */ + void setElseSchema(Schema elseSchema); + + /** + * Sets the "else" schema. If an object is not valid against the "if" schema, then it must be valid against the + * "else" schema. + * + * @param elseSchema + * the else schema + * @return the current Schema instance + * @since 4.0 + */ + default Schema elseSchema(Schema elseSchema) { + setElseSchema(elseSchema); + return this; + } + + /** + * Returns the dependentSchemas property of this Schema instance. + *

    + * For each name and property pair in the map, if the object contains a property with the given name, it must match + * the corresponding schema. + * + * @return a copy Map (potentially immutable) of properties and their dependent schemas + * @since 4.0 + */ + Map getDependentSchemas(); + + /** + * Sets the dependentSchemas property of this Schema instance. + *

    + * For each name and property pair in the map, if the object contains a property with the given name, it must match + * the corresponding schema. + * + * @param dependentSchemas + * a map of properties and their dependent schemas + * @since 4.0 + */ + void setDependentSchemas(Map dependentSchemas); + + /** + * Sets the dependentSchemas property of this Schema instance. + *

    + * For each name and property pair in the map, if the object contains a property with the given name, it must match + * the corresponding schema. + * + * @param dependentSchemas + * a map of properties and their dependent schemas + * @return the current Schema instance + * @since 4.0 + */ + default Schema dependentSchemas(Map dependentSchemas) { + setDependentSchemas(dependentSchemas); + return this; + } + + /** + * Sets the dependent schema for a property name. + *

    + * If the object contains a property with the given name, it must match the dependent schema. + * + * @param propertyName + * the property name + * @param schema + * the dependent schema + * @return the current Schema instance + * @since 4.0 + */ + Schema addDependentSchema(String propertyName, Schema schema); + + /** + * Removes the dependent schema for a property name. + * + * @param propertyName + * the property name + * @since 4.0 + */ + void removeDependentSchema(String propertyName); + + /** + * Returns the prefixItems property of this Schema instance. + *

    + * If the object is an array, the nth item in the array must match the nth schema in this list. + * + * @return a copy List (potentially immutable) of prefix item schemas + * @since 4.0 + */ + List getPrefixItems(); + + /** + * Sets the prefixItems property of this Schema instance. + *

    + * If the object is an array, the nth item in the array must match the nth schema in this list. + * + * @param prefixItems + * a list of prefix item schemas + * @since 4.0 + */ + void setPrefixItems(List prefixItems); + + /** + * Sets the prefixItems property of this Schema instance. + *

    + * If the object is an array, the nth item in the array must match the nth schema in this list. + * + * @param prefixItems + * a list of prefix item schemas + * @return current Schema instance + * @since 4.0 + */ + default Schema prefixItems(List prefixItems) { + setPrefixItems(prefixItems); + return this; + } + + /** + * Adds a schema to the end of the prefixItems list. + * + * @param prefixItem + * the schema to add to the prefixItems list + * @return current Schema instance + * @since 4.0 + */ + Schema addPrefixItem(Schema prefixItem); + + /** + * Removes a schema from the prefixItems list. + * + * @param prefixItem + * the schema to remove from the prefixItems list + * @since 4.0 + */ + void removePrefixItem(Schema prefixItem); + + /** + * Returns the contains property of this Schema instance. + *

    + * If the object is an array, at least one item in the array must match the returned schema. + * + * @return a schema that one item in the array should match + * @since 4.0 + */ + Schema getContains(); + + /** + * Sets the contains property of this Schema instance. + *

    + * If the object is an array, at least one item in the array must match the returned schema. + * + * @param contains + * a schema that one item in the array should match + * @since 4.0 + */ + void setContains(Schema contains); + + /** + * Sets the contains property of this Schema instance. + *

    + * If the object is an array, at least one item in the array must match the returned schema. + * + * @param contains + * a schema that one item in the array should match + * @return the current Schema instance + * @since 4.0 + */ + default Schema contains(Schema contains) { + setContains(contains); + return this; + } + + /** + * Returns the patternProperties property from this Schema instance. + *

    + * The value of patternProperties is a map from a regular expression to a schema. For each string and schema pair in + * the map, if a property name is matched by the regular expression then the value of that property must validate + * against the schema. + * + * @return a copy Map (potentially immutable) of regular expression and schema pairs + * @since 4.0 + */ + Map getPatternProperties(); + + /** + * Sets the patternProperties property from this Schema instance. + *

    + * The value of patternProperties is a map from a regular expression to a schema. For each string and schema pair in + * the map, if a property name is matched by the regular expression then the value of that property must validate + * against the schema. + * + * @param patternProperties + * a map of regular expression and schema pairs + * @since 4.0 + */ + void setPatternProperties(Map patternProperties); + + /** + * Sets the patternProperties property from this Schema instance. + *

    + * The value of patternProperties is a map from a regular expression to a schema. For each string and schema pair in + * the map, if a property name is matched by the regular expression then the value of that property must validate + * against the schema. + * + * @param patternProperties + * a map of regular expression and schema pairs + * @return the current Schema instance + * @since 4.0 + */ + default Schema patternProperties(Map patternProperties) { + setPatternProperties(patternProperties); + return this; + } + + /** + * Adds a regular expression and schema pair to the list of pattern properties. + *

    + * The value of patternProperties is a map from a regular expression to a schema. For each string and schema pair in + * the map, if a property name is matched by the regular expression then the value of that property must validate + * against the schema. + * + * @param regularExpression + * the regular expression to add + * @param schema + * the schema that a property value must validate against if its name matches {@code regularExpression} + * @return the current Schema instance + * @since 4.0 + */ + Schema addPatternProperty(String regularExpression, Schema schema); + + /** + * Removes a regular expression and its corresponding schema pair from the list of pattern properties. + * + * @param regularExpression + * the regular expression to remove + * @since 4.0 + */ + void removePatternProperty(String regularExpression); + + /** + * Returns the propertyNames property from this Schema instance. Each property name in the object must + * validate against this schema. + * + * @return the schema which each property name must validate against + * @since 4.0 + */ + Schema getPropertyNames(); + + /** + * Sets the propertyNames property from this Schema instance. Each property name in the object must + * validate against this schema. + * + * @param propertyNameSchema + * the schema which each property name must validate against + * @since 4.0 + */ + void setPropertyNames(Schema propertyNameSchema); + + /** + * Sets the propertyNames property from this Schema instance. Each property name in the object must + * validate against this schema. + * + * @param propertyNameSchema + * the schema which each property name must validate against + * @return the current Schema instance + * @since 4.0 + */ + default Schema propertyNames(Schema propertyNameSchema) { + setPropertyNames(propertyNameSchema); + return this; + } + + /** + * Returns the unevaluatedItems property of this Schema instance. + *

    + * Items which have not successfully validated against {@code prefixItems}, {@code items}, or {@code contains} must + * validate against this schema. + * + * @return a schema that unevaluated array items must validate against + * @since 4.0 + */ + Schema getUnevaluatedItems(); + + /** + * Sets the unevaluatedItems property of this Schema instance. + *

    + * Items which have not successfully validated against {@code prefixItems}, {@code items}, or {@code contains} must + * validate against this schema. + * + * @param unevaluatedItems + * a schema that unevaluated array items must validate against + * @since 4.0 + */ + void setUnevaluatedItems(Schema unevaluatedItems); + + /** + * Sets the unevaluatedItems property of this Schema instance. + *

    + * Items which have not successfully validated against {@code prefixItems}, {@code items}, or {@code contains} must + * validate against this schema. + * + * @param unevaluatedItems + * a schema that unevaluated array items must validate against + * @return the current Schema instance + * @since 4.0 + */ + default Schema unevaluatedItems(Schema unevaluatedItems) { + setUnevaluatedItems(unevaluatedItems); + return this; + } + + /** + * Returns the unevaluatedProperties property of this Schema instance. + *

    + * Property values which have not successfully validated against {@code properties}, {@code patternProperties}, or + * {@code additionalProperties} must validate against this schema. + * + * @return a schema that unevaluated object properties must validate against + * @since 4.0 + */ + Schema getUnevaluatedProperties(); + + /** + * Sets the unevaluatedProperties property of this Schema instance. + *

    + * Property values which have not successfully validated against {@code properties}, {@code patternProperties}, or + * {@code additionalProperties} must validate against this schema. + * + * @param unevaluatedProperties + * a schema that unevaluated object properties must validate against + * @since 4.0 + */ + void setUnevaluatedProperties(Schema unevaluatedProperties); + + /** + * Sets the unevaluatedProperties property of this Schema instance. + *

    + * Property values which have not successfully validated against {@code properties}, {@code patternProperties}, or + * {@code additionalProperties} must validate against this schema. + * + * @param unevaluatedProperties + * a schema that unevaluated object properties must validate against + * @return the current Schema instance + * @since 4.0 + */ + default Schema unevaluatedProperties(Schema unevaluatedProperties) { + setUnevaluatedProperties(unevaluatedProperties); + return this; + } + + /** + * Returns the const property from this Schema instance. Indicates that the object must have a specific value. + * + * @return the value that the object must have + * @since 4.0 + */ + Object getConstValue(); + + /** + * Sets the const property from this Schema instance. Indicates that the object must have a specific value. + * + * @param constValue + * the value that the object must have + * @since 4.0 + */ + void setConstValue(Object constValue); + + /** + * Sets the const property from this Schema instance. Indicates that the object must have a specific value. + * + * @param constValue + * the value that the object must have + * @return the current Schema instance + * @since 4.0 + */ + default Schema constValue(Object constValue) { + setConstValue(constValue); + return this; + } + + /** + * Returns the maxContains property from this Schema instance. Specifies that {@code contains} must match no more + * than this many items in the array. + * + * @return the max number of items which may be matched by {@code contains} + * @since 4.0 + */ + Integer getMaxContains(); + + /** + * Sets the maxContains property from this Schema instance. Specifies that {@code contains} must match no more than + * this many items in the array. + * + * @param maxContains + * the max number of items which may be matched by {@code contains} + * @since 4.0 + */ + void setMaxContains(Integer maxContains); + + /** + * Sets the maxContains property from this Schema instance. Specifies that {@code contains} must match no more than + * this many items in the array. + * + * @param maxContains + * the maximum number of items which may be matched by {@code contains} + * @return the current Schema instance + * @since 4.0 + */ + default Schema maxContains(Integer maxContains) { + setMaxContains(maxContains); + return this; + } + + /** + * Returns the minContains property from this Schema instance. Specifies that {@code contains} must match at least + * this many items in the array. + * + * @return the minimum number of items which may be matched by {@code contains} + * @since 4.0 + */ + Integer getMinContains(); + + /** + * Sets the minContains property from this Schema instance. Specifies that {@code contains} must match at least this + * many items in the array. + * + * @param minContains + * the minimum number of items which may be matched by {@code contains} + * @since 4.0 + */ + void setMinContains(Integer minContains); + + /** + * Sets the minContains property from this Schema instance. Specifies that {@code contains} must match at least this + * many items in the array. + * + * @param minContains + * the minimum number of items which may be matched by {@code contains} + * @return the current Schema instance + * @since 4.0 + */ + default Schema minContains(Integer minContains) { + setMinContains(minContains); + return this; + } + + /** + * Returns the dependentRequired property of this Schema instance. + *

    + * For each entry in the map, if the key exists as a property name in the object, then the list of names in the + * value must also exist as property names in the object. + * + * @return a copy Map (potentially immutable) of property names to lists of additional required property names + * @since 4.0 + */ + Map> getDependentRequired(); + + /** + * Sets the dependentRequired property of this Schema instance. + *

    + * For each entry in the map, if the key exists as a property name in the object, then the list of names in the + * value must also exist as property names in the object. + * + * @param dependentRequired + * a map of property names to lists of additional required property names + * @since 4.0 + */ + void setDependentRequired(Map> dependentRequired); + + /** + * Sets the dependentRequired property of this Schema instance. + *

    + * For each entry in the map, if the key exists as a property name in the object, then the list of names in the + * value must also exist as property names in the object. + * + * @param dependentRequired + * a map of property names to lists of additional required property names + * @return the current Schema instance + * @since 4.0 + */ + default Schema dependentRequired(Map> dependentRequired) { + setDependentRequired(dependentRequired); + return this; + } + + /** + * Sets the list of additional property names that are required if a property named {@code propertyName} exists. + * + * @param propertyName + * the property name + * @param additionalRequiredPropertyNames + * the names of additional properties which are required if {@code propertyName} exists to add + * @return the current Schema instance + * @since 4.0 + */ + Schema addDependentRequired(String propertyName, List additionalRequiredPropertyNames); + + /** + * Removes the list of additional property names that are required if a property named {@code propertyName} exists. + * + * @param propertyName + * the property name + * @since 4.0 + */ + void removeDependentRequired(String propertyName); + + /** + * Returns the contentEncoding property from this Schema instance. + *

    + * Specifies the encoding used to represent binary data as a string (e.g. base64). + * + * @return the encoding type + * @since 4.0 + */ + String getContentEncoding(); + + /** + * Sets the contentEncoding property from this Schema instance. + *

    + * Specifies the encoding used to represent binary data as a string (e.g. base64). + * + * @param contentEncoding + * the encoding type + * @since 4.0 + */ + void setContentEncoding(String contentEncoding); + + /** + * Sets the contentEncoding property from this Schema instance. + *

    + * Specifies the encoding used to represent binary data as a string (e.g. base64). + * + * @param contentEncoding + * the encoding type + * @return the current Schema instance + * @since 4.0 + */ + default Schema contentEncoding(String contentEncoding) { + setContentEncoding(contentEncoding); + return this; + } + + /** + * Returns the contentMediaType property from this Schema instance. + *

    + * Specifies the media type of the content of a string. + * + * @return the media type + * @since 4.0 + */ + String getContentMediaType(); + + /** + * Sets the contentMediaType property from this Schema instance. + *

    + * Specifies the media type of the content of a string. + * + * @param contentMediaType + * the media type + * @since 4.0 + */ + void setContentMediaType(String contentMediaType); + + /** + * Sets the contentMediaType property from this Schema instance. + *

    + * Specifies the media type of the content of a string. + * + * @param contentMediaType + * the media type + * @return the current Schema instance + * @since 4.0 + */ + default Schema contentMediaType(String contentMediaType) { + setContentMediaType(contentMediaType); + return this; + } + + /** + * Returns the contentSchema property from this Schema instance. + *

    + * If {@code contentMediaType} is a media type that maps into JSON Schema's data model, this property specifies a + * schema that the data in the string must conform to. + * + * @return the schema for the data within the string + * @since 4.0 + */ + Schema getContentSchema(); + + /** + * Sets the contentSchema property from this Schema instance. + *

    + * If {@code contentMediaType} is a media type that maps into JSON Schema's data model, this property specifies a + * schema that the data in the string must conform to. + * + * @param contentSchema + * the schema for the data within the string + * @since 4.0 + */ + void setContentSchema(Schema contentSchema); + + /** + * Sets the contentSchema property from this Schema instance. + *

    + * If {@code contentMediaType} is a media type that maps into JSON Schema's data model, this property specifies a + * schema that the data in the string must conform to. + * + * @param contentSchema + * the schema for the data within the string + * @return the current Schema instance + * @since 4.0 + */ + default Schema contentSchema(Schema contentSchema) { + setContentSchema(contentSchema); + return this; + } + } diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java index a974424c..657bd9a7 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java @@ -30,6 +30,6 @@ *

    */ -@org.osgi.annotation.versioning.Version("2.1") +@org.osgi.annotation.versioning.Version("2.2") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.models.media; \ No newline at end of file diff --git a/pom.xml b/pom.xml index 84e67b00..7f40622c 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI diff --git a/spec/pom.xml b/spec/pom.xml index 05d67944..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 3d7f7a15..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 85370aba..f2e5dfbe 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 3.2-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-tck From 023f45639a6511a6f63f2dbca5d3b3c92aeb7b8f Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 14:10:16 +0000 Subject: [PATCH 016/121] Schema model: add booleanSchema Signifies that this schema represents a single boolean value, rather than a schema object. --- .../openapi/models/media/Schema.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 9cb8582d..aea611c1 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -1949,4 +1949,43 @@ default Schema contentSchema(Schema contentSchema) { return this; } + /** + * Returns whether this Schema is a boolean schema. + *

    + * If this property is not {@code null}, then all other properties are ignored and the schema will be represented by + * a boolean {@code true} or {@code false} value. + * + * @return the boolean value of this schema, or {@code null} if it is not a boolean schema + * @since 4.0 + */ + Boolean getBooleanSchema(); + + /** + * Sets this schema to a boolean value. + *

    + * If this property is not {@code null}, then all other properties are ignored and the schema will be represented by + * a boolean {@code true} or {@code false} value. + * + * @param booleanSchema + * the boolean value of this schema, or {@code null} if it is not a boolean schema + * @since 4.0 + */ + void setBooleanSchema(Boolean booleanSchema); + + /** + * Sets this schema to a boolean value. + *

    + * If this property is not {@code null}, then all other properties are ignored and the schema will be represented by + * a boolean {@code true} or {@code false} value. + * + * @param booleanSchema + * the boolean value of this schema, or {@code null} if it is not a boolean schema + * @return the current Schema instance + * @since 4.0 + */ + default Schema booleanSchema(Boolean booleanSchema) { + setBooleanSchema(booleanSchema); + return this; + } + } From 16c53294c6ba6a9209bb735deccccd686e1e0885 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 15:16:02 +0000 Subject: [PATCH 017/121] Schema model: deprecate bool additionalProperties Now that OpenAPI allows boolean schemas in general, we don't need a special case for additionalProperties. --- .../eclipse/microprofile/openapi/models/media/Schema.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index aea611c1..11e2a524 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -727,7 +727,9 @@ default Schema properties(Map properties) { *

* * @return this Schema's additionalProperties property (as {@link Boolean}) + * @deprecated use {@link #getAdditionalPropertiesSchema()} which may return a boolean-valued schema */ + @Deprecated(since = "4.0") Boolean getAdditionalPropertiesBoolean(); /** @@ -749,7 +751,9 @@ default Schema properties(Map properties) { * * @param additionalProperties * a Schema which defines additional properties + * @deprecated use {@link #setAdditionalPropertiesSchema(Schema)} with a boolean-valued schema */ + @Deprecated(since = "4.0") void setAdditionalPropertiesBoolean(Boolean additionalProperties); /** @@ -775,7 +779,9 @@ default Schema additionalPropertiesSchema(Schema additionalProperties) { * @param additionalProperties * a Schema which defines additional properties * @return the current Schema instance + * @deprecated use {@link #additionalPropertiesSchema(Schema)} with a boolean-valued schema */ + @Deprecated(since = "4.0") default Schema additionalPropertiesBoolean(Boolean additionalProperties) { setAdditionalPropertiesBoolean(additionalProperties); return this; From b64000381779a3b6a34c3cc2c1ff4f351c8e4765 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 15:49:27 +0000 Subject: [PATCH 018/121] Schema model: update readWrite and readOnly These properties are now valid on all schemas. --- .../openapi/models/media/Schema.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 11e2a524..02526cc3 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -879,18 +879,18 @@ default Schema nullable(Boolean nullable) { Boolean getReadOnly(); /** - * Sets the readOnly property of this Schema. Only valid when the Schema is the property in an object. + * Sets the readOnly property of this Schema. * * @param readOnly - * true indicates the Schema should not be sent as part of a request message + * {@code true} indicates the Schema should not be sent as part of a request message */ void setReadOnly(Boolean readOnly); /** - * Sets the readOnly property of this Schema. Only valid when the Schema is the property in an object. + * Sets the readOnly property of this Schema. * * @param readOnly - * true indicates the Schema should not be sent as part of a request message + * {@code true} indicates the Schema should not be sent as part of a request message * @return the current Schema instance */ default Schema readOnly(Boolean readOnly) { @@ -906,18 +906,18 @@ default Schema readOnly(Boolean readOnly) { Boolean getWriteOnly(); /** - * Sets the writeOnly property of this Schema. Only valid when the Schema is the property in an object. + * Sets the writeOnly property of this Schema. * * @param writeOnly - * true indicates the Schema should not be sent as part of a response message + * {@code true} indicates the Schema should not be sent as part of a response message */ void setWriteOnly(Boolean writeOnly); /** - * Sets the writeOnly property of this Schema. Only valid when the Schema is the property in an object. + * Sets the writeOnly property of this Schema. * * @param writeOnly - * true indicates the Schema should not be sent as part of a response message + * {@code true} indicates the Schema should not be sent as part of a response message * @return the current Schema instance */ default Schema writeOnly(Boolean writeOnly) { From 4e22dedd21b239193e1d9d10979f5c098f92d822 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 16:13:13 +0000 Subject: [PATCH 019/121] Schema model: add examples, deprecate example Example is still a valid keyword in OpenAPI 3.1, though it is deprecated in favor of examples. --- .../openapi/models/media/Schema.java | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 02526cc3..4a5b221b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -929,7 +929,9 @@ default Schema writeOnly(Boolean writeOnly) { * Returns the example property from this Schema instance. * * @return an object which is an example of an instance of this Schema - **/ + * @deprecated use {@link #getExamples()} + */ + @Deprecated(since = "4.0") Object getExample(); /** @@ -938,7 +940,9 @@ default Schema writeOnly(Boolean writeOnly) { * * @param example * an object which is an instance of this Schema + * @deprecated use {@link #setExamples(List)} */ + @Deprecated(since = "4.0") void setExample(Object example); /** @@ -948,7 +952,9 @@ default Schema writeOnly(Boolean writeOnly) { * @param example * an object which is an instance of this Schema * @return the current Schema instance + * @deprecated use {@link #examples(List)} */ + @Deprecated(since = "4.0") default Schema example(Object example) { setExample(example); return this; @@ -1994,4 +2000,53 @@ default Schema booleanSchema(Boolean booleanSchema) { return this; } + /** + * Returns the examples property of this Schema instance. + * + * @return a copy List (potentially immutable) of example objects which this schema could describe + * @since 4.0 + */ + List getExamples(); + + /** + * Sets the examples property of this Schema instance. + * + * @param examples + * a list of example objects which this schema could describe + * @since 4.0 + */ + void setExamples(List examples); + + /** + * Sets the examples property of this Schema instance. + * + * @param examples + * a list of example objects which this schema could describe + * @return current Schema instance + * @since 4.0 + */ + default Schema examples(List examples) { + setExamples(examples); + return this; + } + + /** + * Adds an example to the examples list. + * + * @param example + * the example to add to the examples list + * @return current Schema instance + * @since 4.0 + */ + Schema addExample(Object example); + + /** + * Removes an example from the examples list. + * + * @param example + * the example to remove from the examples list + * @since 4.0 + */ + void removeExample(Object example); + } From 8d991ef6dd9fd085818080d631cade1c6a250c94 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 16:15:31 +0000 Subject: [PATCH 020/121] Update package version for breaking model changes --- .../eclipse/microprofile/openapi/models/media/package-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java index 657bd9a7..3e143df6 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/package-info.java @@ -30,6 +30,6 @@ * */ -@org.osgi.annotation.versioning.Version("2.2") +@org.osgi.annotation.versioning.Version("3.0") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.models.media; \ No newline at end of file From 6e495c593b07f7504ec61f46b9fccf8d0c5ce1d3 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 16:22:36 +0000 Subject: [PATCH 021/121] Schema model: numeric exclusive min and max Change exclusiveMinimum and exclusiveMaximum from boolean to BigDecimal. Also update the javadoc for minimum and maximum to make the difference in meaning between the properties more clear. --- .../openapi/models/media/Schema.java | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 4a5b221b..0b618dd4 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -212,7 +212,7 @@ default Schema multipleOf(BigDecimal multipleOf) { /** * Returns the maximum property from this Schema instance. * - * @return the maximum value of a numeric object + * @return the value that a numeric object must be less than or equal to **/ BigDecimal getMaximum(); @@ -220,7 +220,7 @@ default Schema multipleOf(BigDecimal multipleOf) { * Sets the maximum property of this Schema instance to the value given. * * @param maximum - * specifies the maximum numeric value of objects defined by this Schema + * the value that a numeric object must be less than or equal to */ void setMaximum(BigDecimal maximum); @@ -228,7 +228,7 @@ default Schema multipleOf(BigDecimal multipleOf) { * Sets the maximum property of this Schema instance to the value given. * * @param maximum - * specifies the maximum numeric value of objects defined by this Schema + * the value that a numeric object must be less than or equal to * @return the current Schema instance */ default Schema maximum(BigDecimal maximum) { @@ -239,28 +239,29 @@ default Schema maximum(BigDecimal maximum) { /** * Returns the exclusiveMaximum property from this Schema instance. * - * @return whether the numeric value of objects must be less than the maximum property - **/ - Boolean getExclusiveMaximum(); + * @return the value that a numeric object must be less than + * @since 4.0 + */ + BigDecimal getExclusiveMaximum(); /** * Sets the exclusiveMaximum property of this Schema instance to the value given. * * @param exclusiveMaximum - * when true the numeric value of objects defined by this Schema must be less than indicated by the - * maximum property + * the value that a numeric object must be less than + * @since 4.0 */ - void setExclusiveMaximum(Boolean exclusiveMaximum); + void setExclusiveMaximum(BigDecimal exclusiveMaximum); /** * Sets the exclusiveMaximum property of this Schema instance to the value given. * * @param exclusiveMaximum - * when true the numeric value of objects defined by this Schema must be less than indicated by the - * maximum property + * the value that a numeric object must be less than * @return the current Schema instance + * @since 4.0 */ - default Schema exclusiveMaximum(Boolean exclusiveMaximum) { + default Schema exclusiveMaximum(BigDecimal exclusiveMaximum) { setExclusiveMaximum(exclusiveMaximum); return this; } @@ -268,7 +269,7 @@ default Schema exclusiveMaximum(Boolean exclusiveMaximum) { /** * Returns the minimum property from this Schema instance. * - * @return the minimum value of a numeric object + * @return the value that a numeric object must be greater than or equal to **/ BigDecimal getMinimum(); @@ -276,7 +277,7 @@ default Schema exclusiveMaximum(Boolean exclusiveMaximum) { * Sets the minimum property of this Schema instance to the value given. * * @param minimum - * specifies the minimum numeric value of objects defined by this Schema + * the value that a numeric object must be greater than or equal to */ void setMinimum(BigDecimal minimum); @@ -284,7 +285,7 @@ default Schema exclusiveMaximum(Boolean exclusiveMaximum) { * Sets the minimum property of this Schema instance to the value given. * * @param minimum - * specifies the minimum numeric value of objects defined by this Schema + * the value that a numeric object must be greater than or equal to * @return the current Schema instance */ default Schema minimum(BigDecimal minimum) { @@ -295,28 +296,29 @@ default Schema minimum(BigDecimal minimum) { /** * Returns the exclusiveMinimum property from this Schema instance. * - * @return whether the numeric value of objects must be greater than the minimum property - **/ - Boolean getExclusiveMinimum(); + * @return the value that a numeric object must be greater than + * @since 4.0 + */ + BigDecimal getExclusiveMinimum(); /** * Sets the exclusiveMinimum property of this Schema instance to the value given. * * @param exclusiveMinimum - * when true the numeric value of objects defined by this Schema must be greater than indicated by the - * minimum property + * the value that a numeric object must be greater than + * @since 4.0 */ - void setExclusiveMinimum(Boolean exclusiveMinimum); + void setExclusiveMinimum(BigDecimal exclusiveMinimum); /** * Sets the exclusiveMinimum property of this Schema instance to the value given. * * @param exclusiveMinimum - * when true the numeric value of objects defined by this Schema must be greater than indicated by the - * minimum property + * the value that a numeric object must be greater than * @return the current Schema instance + * @since 4.0 */ - default Schema exclusiveMinimum(Boolean exclusiveMinimum) { + default Schema exclusiveMinimum(BigDecimal exclusiveMinimum) { setExclusiveMinimum(exclusiveMinimum); return this; } From 5279bb4a3557d553c496dec49b428bde558f2da3 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 2 Feb 2024 17:57:04 +0000 Subject: [PATCH 022/121] Schema model: update type and nullable Nullable has been removed, type is now permitted to be an array of permitted types and may include null. Attempt to keep the old methods as far as they don't clash with the new ones and can still be defined in a way that makes sense. --- .../openapi/models/media/Schema.java | 82 +++++++++++++++---- 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 0b618dd4..3b28e403 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -47,7 +47,8 @@ public interface Schema extends Extensible, Constructible, Reference required) { void removeRequired(String required); /** - * Returns the type property from this Schema. + * Returns the type property of this Schema instance. Defines the types which are valid. * - * @return the type used in this Schema. Default value must be null - **/ - SchemaType getType(); + * @return a copy List (potentially immutable) of the allowed types + */ + List getType(); /** - * Sets the type used by this Schema to the string given. + * Sets the type property of this Schema instance. Defines the types which are valid. + * + * @param types + * a list of the allowed types + */ + void setType(List types); + + /** + * Sets the type property of this Schema instance. Defines the types which are valid. + * + * @param types + * a list of the allowed types + * @return current Schema instance + * @since "4.0" + */ + default Schema type(List types) { + setType(types); + return this; + } + + /** + * Adds a type to the type list. * * @param type - * the type used by this Schema or null for reference schemas + * the type to add to the type list + * @return current Schema instance + * @since "4.0" */ + Schema addType(SchemaType type); + + /** + * Removes a type from the type list. + * + * @param type + * the type to remove from the type list + * @since "4.0" + */ + void removeType(SchemaType type); + + /** + * Sets the type property of this Schema instance to a single type. + * + * @param type + * the required type + * @since "4.0" + * @deprecated use {@link #setType(List)} + */ + @Deprecated(since = "4.0") void setType(SchemaType type); /** - * Sets the type used by this Schema to the string given. + * Sets the type property of this Schema instance to a single type. * * @param type - * the type used by this Schema or null for reference schemas + * the required type * @return the current Schema instance + * @deprecated use {@link #setType(List)} */ + @Deprecated(since = "4.0") default Schema type(SchemaType type) { setType(type); return this; @@ -847,18 +893,23 @@ default Schema format(String format) { } /** - * Returns the nullable property from this Schema instance which indicates whether null is a valid value. + * Returns whether the type property allows the object to be {@code null} * - * @return the nullable property - **/ + * @return whether null is allowed + * @deprecated use {@link #getType()} and check if the result contains {@link SchemaType#NULL} + */ + @Deprecated(since = "4.0") Boolean getNullable(); /** - * Sets the nullable property of this Schema instance. Specify true if this Schema will allow null values. + * Updates the type property to either permit or disallow {@code null} * * @param nullable - * a boolean value indicating this Schema allows a null value. + * a boolean value indicating whether this Schema allows a null value. + * @deprecated use {@link #setType(List)}, {@link #addType(SchemaType)}, or {@link #removeType(SchemaType)} to add + * or remove {@link SchemaType#NULL} */ + @Deprecated(since = "4.0") void setNullable(Boolean nullable); /** @@ -867,7 +918,10 @@ default Schema format(String format) { * @param nullable * a boolean value indicating this Schema allows a null value. * @return the current Schema instance + * @deprecated use {@link #setType(List)}, {@link #addType(SchemaType)}, or {@link #removeType(SchemaType)} to add + * or remove {@link SchemaType#NULL} */ + @Deprecated(since = "4.0") default Schema nullable(Boolean nullable) { setNullable(nullable); return this; From baf86f877f535e8f3b1038646c744fe1a8d9661b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 28 Mar 2024 15:30:56 +0000 Subject: [PATCH 023/121] Schema model: support arbitrary properties --- .../openapi/models/media/Schema.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 3b28e403..b7b686dd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; +import org.eclipse.microprofile.openapi.OASFactory; import org.eclipse.microprofile.openapi.models.Constructible; import org.eclipse.microprofile.openapi.models.Extensible; import org.eclipse.microprofile.openapi.models.ExternalDocumentation; @@ -2105,4 +2106,85 @@ default Schema examples(List examples) { */ void removeExample(Object example); + /** + * Gets a schema property by name. + *

+ * Allows access to arbitrary properties in a schema object, allowing use of alternative schema dialects which use + * different property names (or the same property names with different data types). + *

+ * When using the standard schema dialect, this method can be used to retrieve values set by other methods. E.g. + * + *

+     * {@code
+     * schema.setMinimum(new BigDecimal(3));
+     * BigDecimal minimum = (BigDecimal) schema.get("minimum"); // returns 3
+     * }
+     * 
+ * + * @param propertyName + * the property name + * @return the value of the named property, or {@code null} if a property with the given name is not set + */ + Object get(String propertyName); + + /** + * Sets a schema property. + *

+ * Allows the modifications of arbitrary schema properties in a schema properties, allowing use of alternative + * schema dialects which use different property names (or the same property names with different data types). + *

+ * Passing {@code null} as the {@code value} removes the property from the schema object. + *

+ * {@code value} must be one of the following types, otherwise non-portable behavior results: + *

    + *
  • Any primitive type + *
  • Any primitive wrapper class + *
  • {@code null} + *
  • {@code String} + *
  • {@code BigDecimal} + *
  • {@code BigInteger} + *
  • Any type which {@link OASFactory} can create + *
  • Any Enumeration + *
  • {@code List} where every value is a permitted type + *
  • {@code Map} where every key is a {@code String} and every value is a permitted type + *
+ * + *

+ * When using the standard schema dialect, values set by this method can be retrieved by other methods. E.g. + * + *

+     * {@code
+     * schema.set("minimum", new BigDecimal(3));
+     * BigDecimal minimum = schema.getMinimum(); // returns 3
+     * }
+     * 
+ * + * @param propertyName + * the property name + * @param value + * the value to set, or {@code null} to remove the property + * @return the current Schema instance + */ + Schema set(String propertyName, Object value); + + /** + * Gets all properties of a schema. + *

+ * Equivalent to calling {@link #get(String)} for each property set to a non-{@code null} value and putting them all + * into a {@code Map}. + * + * @return a {@code Map} of property names to their corresponding values + */ + Map getAll(); + + /** + * Sets all properties of a schema. + *

+ * Equivalent to clearing all properties and then setting each property with {@link #set(String, Object)}. + * + * @param allProperties + * the properties to set. Each value in the map must be valid according to the rules in + * {@link #set(String, Object)} + */ + void setAll(Map allProperties); } From ece7068c99a001bbdde219cd86addadaaba81836 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 13 Feb 2024 11:27:12 +0000 Subject: [PATCH 024/121] Update TCKs for Schema.examples Example changed to examples and now must be an array. --- .../openapi/tck/AirlinesAppTest.java | 16 ++++++++-------- tck/src/main/resources/openapi.yaml | 6 ++++-- tck/src/main/resources/simpleapi.yaml | 18 ++++++++++++------ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index c938d71c..42207e17 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -704,7 +704,7 @@ public void testSchema(String type) { vr.body("components.schemas.id.format", equalTo("int32")); vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.description", equalTo("id of the new booking")); - vr.body("components.schemas.User.properties.password.example", equalTo("bobSm37")); + vr.body("components.schemas.User.properties.password.examples", contains("bobSm37")); // Object properties vr.body("paths.'/user'.post.requestBody.content.'application/json'.schema.maxProperties", equalTo(1024)); @@ -726,7 +726,7 @@ public void testSchema(String type) { public void testSchemaProperty(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(10)); - vr.body("components.schemas.User.properties.phone.example", equalTo("123-456-7891")); + vr.body("components.schemas.User.properties.phone.examples", contains("123-456-7891")); vr.body("components.schemas.User.properties.phone.description", equalTo("Telephone number to contact the user")); vr.body("components.schemas.User.properties.phone.x-schema-property", equalTo("test-schema-property")); @@ -736,8 +736,8 @@ public void testSchemaProperty(String type) { public void testSchemaPropertyValuesOverrideClassPropertyValues(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(10)); - vr.body("components.schemas.User.properties.phone.example", not("123-456-7890")); - vr.body("components.schemas.User.properties.phone.example", equalTo("123-456-7891")); + vr.body("components.schemas.User.properties.phone.examples", not(contains("123-456-7890"))); + vr.body("components.schemas.User.properties.phone.examples", contains("123-456-7891")); } @Test(dataProvider = "formatProvider") @@ -992,8 +992,8 @@ public void testStaticFileDefinitions(String type) { containsString("the location where data will be sent.")); vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.type", equalTo("string")); vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.format", equalTo("uri")); - vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.example", - equalTo("https://tonys-server.com")); + vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.examples", + contains("https://tonys-server.com")); final String responsePath = "paths.'/streams'.post.responses"; vr.body(responsePath, aMapWithSize(1)); @@ -1008,8 +1008,8 @@ public void testStaticFileDefinitions(String type) { equalTo("this unique identifier allows management of the subscription")); vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.type", equalTo("string")); - vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.example", - equalTo("2531329f-fb09-4ef7-887e-84e648214436")); + vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.examples", + contains("2531329f-fb09-4ef7-887e-84e648214436")); final String callbacksPath = "paths.'/streams'.post.callbacks.onData.'{$request.query.callbackUrl}/data'.post"; vr.body(callbacksPath + ".requestBody.description", equalTo("subscription payload")); diff --git a/tck/src/main/resources/openapi.yaml b/tck/src/main/resources/openapi.yaml index 94bc335b..94016fcf 100644 --- a/tck/src/main/resources/openapi.yaml +++ b/tck/src/main/resources/openapi.yaml @@ -30,7 +30,8 @@ paths: schema: type: string format: uri - example: https://tonys-server.com + examples: + - https://tonys-server.com responses: '201': description: subscription successfully created @@ -44,7 +45,8 @@ paths: subscriptionId: description: this unique identifier allows management of the subscription type: string - example: 2531329f-fb09-4ef7-887e-84e648214436 + examples: + - 2531329f-fb09-4ef7-887e-84e648214436 callbacks: # the name `onData` is a convenience locator onData: diff --git a/tck/src/main/resources/simpleapi.yaml b/tck/src/main/resources/simpleapi.yaml index a081863e..7e414995 100644 --- a/tck/src/main/resources/simpleapi.yaml +++ b/tck/src/main/resources/simpleapi.yaml @@ -133,14 +133,17 @@ components: id: type: string format: uuid - example: d290f1ee-6c54-4b01-90e6-d701748f0851 + examples: + - d290f1ee-6c54-4b01-90e6-d701748f0851 name: type: string - example: Widget Adapter + examples: + - Widget Adapter releaseDate: type: string format: int32 - example: '2016-08-29T09:12:33.001Z' + examples: + - '2016-08-29T09:12:33.001Z' manufacturer: $ref: '#/components/schemas/Manufacturer' Manufacturer: @@ -149,12 +152,15 @@ components: properties: name: type: string - example: ACME Corporation + examples: + - ACME Corporation homePage: type: string format: url - example: 'https://www.acme-corp.com' + examples: + - 'https://www.acme-corp.com' phone: type: string - example: 408-867-5309 + examples: + - 408-867-5309 type: object \ No newline at end of file From 7314481e1c154ab698f96858463d5dc4c20f58dd Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 13 Feb 2024 13:04:13 +0000 Subject: [PATCH 025/121] TCK updates for Schema.type Schema.type can now be either a string or an array of strings --- .../openapi/tck/AirlinesAppTest.java | 39 ++++++------ .../microprofile/openapi/tck/FilterTest.java | 5 +- .../openapi/tck/ModelReaderAppTest.java | 7 ++- .../openapi/tck/OASConfigSchemaTest.java | 4 +- .../openapi/tck/PetStoreAppTest.java | 9 +-- .../beanvalidation/BeanValidationTest.java | 24 ++++---- .../openapi/tck/utils/TCKMatchers.java | 60 +++++++++++++++++++ 7 files changed, 108 insertions(+), 40 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 42207e17..39551bba 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -16,6 +16,7 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.anEmptyMap; import static org.hamcrest.Matchers.both; @@ -360,7 +361,7 @@ private void testUserLoginMethods(ValidatableResponse vr) { vr.body(query + ".in", both(hasSize(1)).and(contains("query"))); vr.body(query + ".description", both(hasSize(1)).and(contains(list.get(i)[1]))); vr.body(query + ".required", both(hasSize(1)).and(contains(true))); - vr.body(query + ".schema.type", both(hasSize(1)).and(contains("string"))); + vr.body(query + ".schema.type", both(hasSize(1)).and(contains(itemOrSingleton("string")))); } } @@ -373,7 +374,7 @@ private void testReviewIdMethods(ValidatableResponse vr) { both(hasSize(1)).and(contains("ID of the booking"))); vr.body(reviewParameters + ".findAll { it.name == 'id' }.required", both(hasSize(1)).and(contains(true))); vr.body(reviewParameters + ".findAll { it.name == 'id' }.content.'*/*'.schema.type", - both(hasSize(1)).and(contains("integer"))); + both(hasSize(1)).and(contains(itemOrSingleton("integer")))); } private void testBookingIdMethods(ValidatableResponse vr) { @@ -386,7 +387,7 @@ private void testBookingIdMethods(ValidatableResponse vr) { vr.body(bookingParameters + ".findAll { it }.name", contains("id")); vr.body(bookingParameters + ".findAll { it.name == 'id' }.required", both(hasSize(1)).and(contains(true))); vr.body(bookingParameters + ".findAll { it.name == 'id' }.schema.type", - both(hasSize(1)).and(contains("integer"))); + both(hasSize(1)).and(contains(itemOrSingleton("integer")))); } bookingParameters = "paths.'/bookings/{id}'.get.parameters"; @@ -415,7 +416,7 @@ private void testAvailabilityGetParamater(ValidatableResponse vr) { vr.body(query + ".in", both(hasSize(1)).and(contains("query"))); vr.body(query + ".description", both(hasSize(1)).and(contains(list.get(i)[1]))); vr.body(query + ".required", both(hasSize(1)).and(contains(true))); - vr.body(query + ".schema.type", both(hasSize(1)).and(contains("string"))); + vr.body(query + ".schema.type", both(hasSize(1)).and(contains(itemOrSingleton("string")))); } vr.body(availabilityParameters + ".findAll { it.name == 'numberOfAdults' }.schema.minimum", @@ -467,13 +468,13 @@ public void testCallbackOperationAnnotations(String type) { vr.body(endpoint, hasKey("get")); vr.body(endpoint + ".get.summary", equalTo("Retrieve all bookings for current user")); vr.body(endpoint + ".get.responses.'200'.description", equalTo("Bookings retrieved")); - vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.type", equalTo("array")); + vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.type", itemOrSingleton("array")); endpoint = "paths.'/reviews'.post.callbacks.testCallback.'http://localhost:9080/oas3-airlines/reviews'"; vr.body(endpoint, hasKey("get")); vr.body(endpoint + ".get.summary", equalTo("Get all reviews")); vr.body(endpoint + ".get.responses.'200'.description", equalTo("successful operation")); - vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.type", equalTo("array")); + vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.type", itemOrSingleton("array")); vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.items", notNullValue()); vr.body(endpoint + ".get.x-callback-operation", equalTo("test-callback-operation")); } @@ -700,7 +701,7 @@ public void testSchema(String type) { vr.body("components.schemas.AirlinesRef.$ref", equalTo("#/components/schemas/Airlines")); vr.body("components.schemas.Airlines.title", equalTo("Airlines")); vr.body("components.schemas.Airlines.x-schema", equalTo("test-schema")); - vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", equalTo("string")); + vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", itemOrSingleton("string")); vr.body("components.schemas.id.format", equalTo("int32")); vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.description", equalTo("id of the new booking")); @@ -852,7 +853,7 @@ public void testHeaderInAPIResponse(String type) { vr.body(responseHeader1 + ".deprecated", equalTo(true)); vr.body(responseHeader1 + ".allowEmptyValue", equalTo(true)); vr.body(responseHeader1 + ".style", equalTo("simple")); - vr.body(responseHeader1 + ".schema.type", equalTo("integer")); + vr.body(responseHeader1 + ".schema.type", itemOrSingleton("integer")); String responseHeader2 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader2"; vr.body(responseHeader2, notNullValue()); @@ -861,7 +862,7 @@ public void testHeaderInAPIResponse(String type) { vr.body(responseHeader2 + ".deprecated", equalTo(true)); vr.body(responseHeader2 + ".allowEmptyValue", equalTo(true)); vr.body(responseHeader2 + ".style", equalTo("simple")); - vr.body(responseHeader2 + ".schema.type", equalTo("string")); + vr.body(responseHeader2 + ".schema.type", itemOrSingleton("string")); } @Test(dataProvider = "formatProvider") @@ -877,7 +878,7 @@ public void testHeaderInEncoding(String type) { vr.body(testHeader + ".deprecated", equalTo(true)); vr.body(testHeader + ".allowEmptyValue", equalTo(true)); vr.body(testHeader + ".style", equalTo("simple")); - vr.body(testHeader + ".schema.type", equalTo("integer")); + vr.body(testHeader + ".schema.type", itemOrSingleton("integer")); } @Test(dataProvider = "formatProvider") @@ -910,7 +911,7 @@ public void testHeaderInComponents(String type) { vr.body(maxRate + ".deprecated", equalTo(true)); vr.body(maxRate + ".allowEmptyValue", equalTo(true)); vr.body(maxRate + ".style", equalTo("simple")); - vr.body(maxRate + ".schema.type", equalTo("integer")); + vr.body(maxRate + ".schema.type", itemOrSingleton("integer")); vr.body(maxRate + ".x-header", equalTo("test-header")); } @@ -920,7 +921,7 @@ public void testContentInAPIResponse(String type) { String content1 = "paths.'/availability'.get.responses.'200'.content.'application/json'"; vr.body(content1, notNullValue()); - vr.body(content1 + ".schema.type", equalTo("array")); + vr.body(content1 + ".schema.type", itemOrSingleton("array")); vr.body(content1 + ".schema.items", notNullValue()); vr.body(content1 + ".x-content", equalTo("test-content")); @@ -953,7 +954,7 @@ public void testContentInParameter(String type) { String content = "paths.'/reviews/users/{user}'.get.parameters.find{ it.name == 'user' }.content"; vr.body(content, notNullValue()); vr.body(content + ".'*/*'", notNullValue()); - vr.body(content + ".'*/*'.schema.type", equalTo("string")); + vr.body(content + ".'*/*'.schema.type", itemOrSingleton("string")); } @Test(dataProvider = "formatProvider") @@ -990,7 +991,7 @@ public void testStaticFileDefinitions(String type) { vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.required", equalTo(true)); vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.description", containsString("the location where data will be sent.")); - vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.type", equalTo("string")); + vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.type", itemOrSingleton("string")); vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.format", equalTo("uri")); vr.body(parametersPath + ".find{ it.name == 'callbackUrl' }.schema.examples", contains("https://tonys-server.com")); @@ -1007,18 +1008,18 @@ public void testStaticFileDefinitions(String type) { vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.description", equalTo("this unique identifier allows management of the subscription")); vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.type", - equalTo("string")); + itemOrSingleton("string")); vr.body(response201Path + ".content.'application/json'.schema.properties.subscriptionId.examples", contains("2531329f-fb09-4ef7-887e-84e648214436")); final String callbacksPath = "paths.'/streams'.post.callbacks.onData.'{$request.query.callbackUrl}/data'.post"; vr.body(callbacksPath + ".requestBody.description", equalTo("subscription payload")); vr.body(callbacksPath + ".requestBody.content.'application/json'.schema.properties.timestamp.type", - equalTo("string")); + itemOrSingleton("string")); vr.body(callbacksPath + ".requestBody.content.'application/json'.schema.properties.timestamp.format", equalTo("date-time")); vr.body(callbacksPath + ".requestBody.content.'application/json'.schema.properties.userData.type", - equalTo("string")); + itemOrSingleton("string")); vr.body(callbacksPath + ".responses", aMapWithSize(2)); vr.body(callbacksPath + ".responses.'202'.description", @@ -1055,7 +1056,7 @@ public void testExceptionMappers(String type) { String rejectedReviewSchema = dereference(vr, "paths.'/reviews'.post.responses.'400'.content.'application/json'.schema"); - vr.body(rejectedReviewSchema + ".type", equalTo("object")); + vr.body(rejectedReviewSchema + ".type", itemOrSingleton("object")); vr.body(rejectedReviewSchema + ".properties", hasKey("reason")); } @@ -1104,7 +1105,7 @@ public void testAdditionalPropertiesTypeString(String type) { vr.body(responseSchema, notNullValue()); String flightSchema = dereference(vr, responseSchema, "properties.returningFlight"); - vr.body(flightSchema + ".additionalProperties.type", equalTo("string")); + vr.body(flightSchema + ".additionalProperties.type", itemOrSingleton("string")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java index dbc4abf0..70d11bd7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java @@ -16,6 +16,7 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; @@ -112,7 +113,7 @@ public void testFilterParameter(String type) { vr.body(username + ".in", both(hasSize(1)).and(contains("query"))); vr.body(username + ".description", both(hasSize(1)).and(contains("filterParameter - The user name for login"))); vr.body(username + ".required", both(hasSize(1)).and(contains(true))); - vr.body(username + ".schema.type", both(hasSize(1)).and(contains("string"))); + vr.body(username + ".schema.type", both(hasSize(1)).and(contains(itemOrSingleton("string")))); // Parameter named 'password' should have been removed by filter vr.body(reviewParameters, hasSize(1)); @@ -161,7 +162,7 @@ public void testFilterHeader(String type) { vr.body(maxRate + ".deprecated", equalTo(true)); vr.body(maxRate + ".allowEmptyValue", equalTo(true)); vr.body(maxRate + ".style", equalTo("simple")); - vr.body(maxRate + ".schema.type", equalTo("integer")); + vr.body(maxRate + ".schema.type", itemOrSingleton("integer")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index cfdf6438..6b240cb5 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -16,6 +16,7 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; @@ -169,7 +170,7 @@ public void testAvailabilityGetParameter(String type) { vr.body(query + ".in", both(hasSize(1)).and(contains("query"))); vr.body(query + ".description", both(hasSize(1)).and(contains(list.get(i)[1]))); vr.body(query + ".required", both(hasSize(1)).and(contains(true))); - vr.body(query + ".schema.type", both(hasSize(1)).and(contains("string"))); + vr.body(query + ".schema.type", both(hasSize(1)).and(contains(itemOrSingleton("string")))); } vr.body(availabilityParameters + ".findAll { it.name == 'numberOfAdults' }.schema.minimum", @@ -211,7 +212,7 @@ public void testSchema(String type) { vr.body("components.schemas.AirlinesRef.$ref", equalTo("#/components/schemas/Airlines")); vr.body("components.schemas.Airlines.title", equalTo("Airlines")); vr.body("paths.'/modelReader/bookings'.post.responses.'201'.content.'text/plain'.schema.type", - equalTo("string")); + itemOrSingleton("string")); vr.body("components.schemas.id.format", equalTo("int32")); vr.body("paths.'/modelReader/bookings'.post.responses.'201'.content.'text/plain'.schema.description", equalTo("id of the new booking")); @@ -291,7 +292,7 @@ public void testContentInAPIResponse(String type) { String content1 = "paths.'/availability'.get.responses.'200'.content.'application/json'"; vr.body(content1, notNullValue()); - vr.body(content1 + ".schema.type", equalTo("array")); + vr.body(content1 + ".schema.type", itemOrSingleton("array")); vr.body(content1 + ".schema.items", notNullValue()); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java index e42285ba..e15751b0 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java @@ -16,9 +16,11 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.is; import static org.hamcrest.collection.IsMapWithSize.aMapWithSize; import java.util.Map; @@ -53,7 +55,7 @@ public void testSchemaConfigApplied(String type) { private Matcher> epochSecondsSchema() { return allOf(aMapWithSize(4), hasEntry("title", "Epoch Seconds"), - hasEntry("type", "number"), + hasEntry(is("type"), itemOrSingleton("number")), hasEntry("format", "int64"), hasEntry("description", "Number of seconds from the epoch of 1970-01-01T00:00:00Z")); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 23b3bd94..11fc7757 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -18,6 +18,7 @@ import static io.restassured.RestAssured.given; import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.comparesEqualToNumber; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; @@ -218,7 +219,7 @@ public void testRequestBodySchema(String type) { vr.body(schemaObject, allOf(aMapWithSize(3), hasEntry(equalTo("required"), notNullValue()), - hasEntry(equalTo("type"), equalTo("object")), + hasEntry(equalTo("type"), itemOrSingleton("object")), hasEntry(equalTo("properties"), notNullValue()))); } @@ -241,7 +242,7 @@ public void testAPIResponseSchema(String type) { vr.body(schemaObject, allOf(aMapWithSize(3), hasEntry(equalTo("required"), notNullValue()), - hasEntry(equalTo("type"), equalTo("object")), + hasEntry(equalTo("type"), itemOrSingleton("object")), hasEntry(equalTo("properties"), notNullValue()))); } @@ -265,7 +266,7 @@ public void testAPIResponseSchemaDefaultResponseCode(String type) { vr.body(arraySchemaObject, allOf(aMapWithSize(2), - hasEntry(equalTo("type"), equalTo("array")), + hasEntry(equalTo("type"), itemOrSingleton("array")), hasEntry(equalTo("items"), notNullValue()))); String schemaObject = dereference(vr, arraySchemaObject + ".items"); @@ -273,7 +274,7 @@ public void testAPIResponseSchemaDefaultResponseCode(String type) { vr.body(schemaObject, allOf(aMapWithSize(3), hasEntry(equalTo("required"), notNullValue()), - hasEntry(equalTo("type"), equalTo("object")), + hasEntry(equalTo("type"), itemOrSingleton("object")), hasEntry(equalTo("properties"), notNullValue()))); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java index f94d45a6..e55a431a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java @@ -16,8 +16,10 @@ package org.eclipse.microprofile.openapi.tck.beanvalidation; import static org.eclipse.microprofile.openapi.tck.Groups.BEAN_VALIDATION; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import org.eclipse.microprofile.openapi.apps.beanvalidation.BeanValidationApp; @@ -42,21 +44,21 @@ public static WebArchive buildApp() { public void notEmptyStringTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "notEmptyString", hasEntry("minLength", 1)); - assertProperty(vr, "notEmptyString", hasEntry("type", "string")); + assertProperty(vr, "notEmptyString", hasEntry(is("type"), itemOrSingleton("string"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void notEmptyListTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "notEmptyList", hasEntry("minItems", 1)); - assertProperty(vr, "notEmptyList", hasEntry("type", "array")); + assertProperty(vr, "notEmptyList", hasEntry(is("type"), itemOrSingleton("array"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void notEmptyMapTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "notEmptyMap", hasEntry("minProperties", 1)); - assertProperty(vr, "notEmptyMap", hasEntry("type", "object")); + assertProperty(vr, "notEmptyMap", hasEntry(is("type"), itemOrSingleton("object"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -70,7 +72,7 @@ public void sizedStringTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "sizedString", hasEntry("minLength", 2)); assertProperty(vr, "sizedString", hasEntry("maxLength", 7)); - assertProperty(vr, "sizedString", hasEntry("type", "string")); + assertProperty(vr, "sizedString", hasEntry(is("type"), itemOrSingleton("string"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -78,7 +80,7 @@ public void sizedListTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "sizedList", hasEntry("minItems", 1)); assertProperty(vr, "sizedList", hasEntry("maxItems", 10)); - assertProperty(vr, "sizedList", hasEntry("type", "array")); + assertProperty(vr, "sizedList", hasEntry(is("type"), itemOrSingleton("array"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -86,14 +88,14 @@ public void sizedMapTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "sizedMap", hasEntry("minProperties", 3)); assertProperty(vr, "sizedMap", hasEntry("maxProperties", 5)); - assertProperty(vr, "sizedMap", hasEntry("type", "object")); + assertProperty(vr, "sizedMap", hasEntry(is("type"), itemOrSingleton("object"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void maxDecimalInclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "maxDecimalInclusive", hasEntry("maximum", 1.5f)); - assertProperty(vr, "maxDecimalInclusive", hasEntry("type", "number")); + assertProperty(vr, "maxDecimalInclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -101,14 +103,14 @@ public void maxDecimalExclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "maxDecimalExclusive", hasEntry("maximum", 1.5f)); assertProperty(vr, "maxDecimalExclusive", hasEntry("exclusiveMaximum", true)); - assertProperty(vr, "maxDecimalExclusive", hasEntry("type", "number")); + assertProperty(vr, "maxDecimalExclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void minDecimalInclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "minDecimalInclusive", hasEntry("minimum", 3.25f)); - assertProperty(vr, "minDecimalInclusive", hasEntry("type", "number")); + assertProperty(vr, "minDecimalInclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -116,7 +118,7 @@ public void minDecimalExclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "minDecimalExclusive", hasEntry("minimum", 3.25f)); assertProperty(vr, "minDecimalExclusive", hasEntry("exclusiveMinimum", true)); - assertProperty(vr, "minDecimalExclusive", hasEntry("type", "number")); + assertProperty(vr, "minDecimalExclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) @@ -180,7 +182,7 @@ public void parameterTest(String format) { ValidatableResponse vr = callEndpoint(format); String schemaPath = dereference(vr, "paths.'/parameter/{test}'.post.parameters[0]", "schema"); vr.body(schemaPath, hasEntry("maxLength", 6)); - vr.body(schemaPath, hasEntry("type", "string")); + vr.body(schemaPath, hasEntry(is("type"), itemOrSingleton("string"))); } /** diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java index b819359a..924f80be 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java @@ -15,12 +15,16 @@ */ package org.eclipse.microprofile.openapi.tck.utils; +import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.comparator.ComparatorMatcherBuilder.comparedBy; import java.math.BigDecimal; +import java.util.Collection; import java.util.Comparator; +import org.hamcrest.Description; import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; public final class TCKMatchers { @@ -55,4 +59,60 @@ private TCKMatchers() { public static Matcher comparesEqualToNumber(Number expected) { return comparedBy(NUMERIC_COMPARATOR).comparesEqualTo(expected); } + + /** + * Creates a matcher which matches an item or a {@link Collection} containing just that item + * + * @param itemMatcher + * the matcher for the item + * @return the matcher + */ + public static Matcher itemOrSingleton(Matcher itemMatcher) { + return new ItemOrSingletonMatcher(itemMatcher); + } + + /** + * Creates a matcher which matches an item or a {@link Collection} containing just that item + * + * @param item + * the item + * @return the matcher + */ + public static Matcher itemOrSingleton(Object item) { + return itemOrSingleton(equalTo(item)); + } + + + public static class ItemOrSingletonMatcher extends TypeSafeDiagnosingMatcher { + + private Matcher baseMatcher; + + public ItemOrSingletonMatcher(Matcher baseMatcher) { + super(Object.class); + this.baseMatcher = baseMatcher; + } + + @Override + public void describeTo(Description description) { + description.appendText("An item or singleton list containing ").appendDescriptionOf(baseMatcher); + } + + @Override + protected boolean matchesSafely(Object item, Description mismatchDescription) { + if (item instanceof Collection) { + Collection collection = (Collection) item; + if (collection.size() != 1) { + mismatchDescription.appendText("object is a collection of size ").appendValue(collection.size()); + return false; + } + item = collection.iterator().next(); + } + + boolean result = baseMatcher.matches(item); + if (!result) { + baseMatcher.describeMismatch(item, mismatchDescription); + } + return result; + } + } } From 1e1442ae9225b99c271dfbae20aeb8aac100c52b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 13 Feb 2024 13:07:23 +0000 Subject: [PATCH 026/121] Upate existing TCK for Schema.nullable --- .../org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 39551bba..877e514b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.List; +import org.hamcrest.Matchers; import org.hamcrest.collection.IsMapWithSize; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -716,7 +717,7 @@ public void testSchema(String type) { // Array properties String createSchema = "paths.'/user/createWithArray'.post.requestBody.content.'application/json'.schema"; - vr.body(createSchema + ".nullable", equalTo(true)); + vr.body(createSchema + ".type", containsInAnyOrder("array", "null")); vr.body(createSchema + ".writeOnly", equalTo(true)); vr.body(createSchema + ".maxItems", equalTo(20)); vr.body(createSchema + ".minItems", equalTo(2)); From 00700d506b4acb3c80cf9f4379693e84c270b5f4 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 13 Feb 2024 14:32:17 +0000 Subject: [PATCH 027/121] Update TCKs for Schema.exclusiveMinimum|Maximum exclusiveMinimum and exclusiveMaximum are now standalone numeric properties, rather than boolean properties interpreted in conjunction with minimum and maximum. --- .../openapi/tck/PetStoreAppTest.java | 8 ++------ .../beanvalidation/BeanValidationTest.java | 20 +++++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 11fc7757..024856f1 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -61,14 +61,10 @@ public void testSchema(String type) { vr.body("paths.'/store/order/{orderId}'.get.responses.'599'.schema", nullValue()); // Numerical properties - vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.maximum", - comparesEqualToNumber(101.0)); vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.exclusiveMaximum", - equalTo(true)); - vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.minimum", - comparesEqualToNumber(9)); + comparesEqualToNumber(101.0)); vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.exclusiveMinimum", - equalTo(true)); + comparesEqualToNumber(9)); vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.multipleOf", comparesEqualToNumber(10)); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java index e55a431a..396f3943 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/beanvalidation/BeanValidationTest.java @@ -95,14 +95,15 @@ public void sizedMapTest(String format) { public void maxDecimalInclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "maxDecimalInclusive", hasEntry("maximum", 1.5f)); + assertProperty(vr, "maxDecimalInclusive", not(hasKey("exclusiveMaximum"))); assertProperty(vr, "maxDecimalInclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void maxDecimalExclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); - assertProperty(vr, "maxDecimalExclusive", hasEntry("maximum", 1.5f)); - assertProperty(vr, "maxDecimalExclusive", hasEntry("exclusiveMaximum", true)); + assertProperty(vr, "maxDecimalExclusive", hasEntry("exclusiveMaximum", 1.5f)); + assertProperty(vr, "maxDecimalExclusive", not(hasKey("maximum"))); assertProperty(vr, "maxDecimalExclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @@ -110,14 +111,15 @@ public void maxDecimalExclusiveTest(String format) { public void minDecimalInclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "minDecimalInclusive", hasEntry("minimum", 3.25f)); + assertProperty(vr, "minDecimalInclusive", not(hasKey("exclusiveMinimum"))); assertProperty(vr, "minDecimalInclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void minDecimalExclusiveTest(String format) { ValidatableResponse vr = callEndpoint(format); - assertProperty(vr, "minDecimalExclusive", hasEntry("minimum", 3.25f)); - assertProperty(vr, "minDecimalExclusive", hasEntry("exclusiveMinimum", true)); + assertProperty(vr, "minDecimalExclusive", hasEntry("exclusiveMinimum", 3.25f)); + assertProperty(vr, "minDecimalExclusive", not(hasKey("minimum"))); assertProperty(vr, "minDecimalExclusive", hasEntry(is("type"), itemOrSingleton("number"))); } @@ -136,27 +138,29 @@ public void minIntTest(String format) { @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void negativeIntTest(String format) { ValidatableResponse vr = callEndpoint(format); - assertProperty(vr, "negativeInt", hasEntry("maximum", 0)); - assertProperty(vr, "negativeInt", hasEntry("exclusiveMaximum", true)); + assertProperty(vr, "negativeInt", hasEntry("exclusiveMaximum", 0)); + assertProperty(vr, "negativeInt", not(hasKey("maximum"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void negativeOrZeroIntTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "negativeOrZeroInt", hasEntry("maximum", 0)); + assertProperty(vr, "negativeOrZeroInt", not(hasKey("exclusiveMaximum"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void positiveIntTest(String format) { ValidatableResponse vr = callEndpoint(format); - assertProperty(vr, "positiveInt", hasEntry("minimum", 0)); - assertProperty(vr, "positiveInt", hasEntry("exclusiveMinimum", true)); + assertProperty(vr, "positiveInt", hasEntry("exclusiveMinimum", 0)); + assertProperty(vr, "positiveInt", not(hasKey("minimum"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) public void positiveOrZeroIntTest(String format) { ValidatableResponse vr = callEndpoint(format); assertProperty(vr, "positiveOrZeroInt", hasEntry("minimum", 0)); + assertProperty(vr, "positiveOrZeroInt", not(hasKey("exclusiveMinimum"))); } @Test(dataProvider = "formatProvider", groups = BEAN_VALIDATION) From 738df493a18a31b26bc7d8c0dcd75ad468a83c18 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 18 Mar 2024 17:06:48 +0000 Subject: [PATCH 028/121] Update TCKs to allow type to be an array --- .../microprofile/openapi/tck/AirlinesAppTest.java | 4 ++-- .../microprofile/openapi/tck/OASConfigSchemaTest.java | 9 ++++++--- .../microprofile/openapi/tck/utils/TCKMatchers.java | 3 +-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 877e514b..96b54ecb 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -42,7 +42,6 @@ import java.util.ArrayList; import java.util.List; -import org.hamcrest.Matchers; import org.hamcrest.collection.IsMapWithSize; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -702,7 +701,8 @@ public void testSchema(String type) { vr.body("components.schemas.AirlinesRef.$ref", equalTo("#/components/schemas/Airlines")); vr.body("components.schemas.Airlines.title", equalTo("Airlines")); vr.body("components.schemas.Airlines.x-schema", equalTo("test-schema")); - vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", itemOrSingleton("string")); + vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", + itemOrSingleton("string")); vr.body("components.schemas.id.format", equalTo("int32")); vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.description", equalTo("id of the new booking")); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java index e15751b0..e5b51949 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigSchemaTest.java @@ -26,6 +26,7 @@ import java.util.Map; import org.hamcrest.Matcher; +import org.hamcrest.Matchers; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; @@ -52,12 +53,14 @@ public void testSchemaConfigApplied(String type) { anyOf(epochSecondsSchema(), epochSecondsRef())); } - private Matcher> epochSecondsSchema() { - return allOf(aMapWithSize(4), + private Matcher> epochSecondsSchema() { + return Matchers.>allOf( + aMapWithSize(4), hasEntry("title", "Epoch Seconds"), hasEntry(is("type"), itemOrSingleton("number")), hasEntry("format", "int64"), - hasEntry("description", "Number of seconds from the epoch of 1970-01-01T00:00:00Z")); + hasEntry("description", + "Number of seconds from the epoch of 1970-01-01T00:00:00Z")); } private Matcher> epochSecondsRef() { diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java index 924f80be..68047270 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java @@ -70,7 +70,7 @@ public static Matcher comparesEqualToNumber(Number expected) { public static Matcher itemOrSingleton(Matcher itemMatcher) { return new ItemOrSingletonMatcher(itemMatcher); } - + /** * Creates a matcher which matches an item or a {@link Collection} containing just that item * @@ -82,7 +82,6 @@ public static Matcher itemOrSingleton(Object item) { return itemOrSingleton(equalTo(item)); } - public static class ItemOrSingletonMatcher extends TypeSafeDiagnosingMatcher { private Matcher baseMatcher; From da4400f3f4fb92264f7bf36c62cf9556849e53d6 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 2 Apr 2024 17:30:21 +0100 Subject: [PATCH 029/121] Improve error reporting in ModelConstructionTest The exception type and stack-trace is important here. --- .../microprofile/openapi/tck/ModelConstructionTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index aadb17d4..af63cb2d 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -166,7 +166,7 @@ public Object invokeGetter(Object target) { try { return getter.invoke(target); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - fail("Invocation of getter method \"" + getter.getName() + "\" failed: " + e.getMessage()); + fail("Invocation of getter method \"" + getter.getName() + "\" failed: " + e.getMessage(), e); throw new RuntimeException(e); } } @@ -174,7 +174,7 @@ public void invokeSetter(Object target, Object value) { try { setter.invoke(target, value); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - fail("Invocation of setter method \"" + setter.getName() + "\" failed: " + e.getMessage()); + fail("Invocation of setter method \"" + setter.getName() + "\" failed: " + e.getMessage(), e); throw new RuntimeException(e); } } @@ -182,7 +182,7 @@ public Object invokeBuilder(Object target, Object value) { try { return builder.invoke(target, value); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - fail("Invocation of builder method \"" + builder.getName() + "\" failed: " + e.getMessage()); + fail("Invocation of builder method \"" + builder.getName() + "\" failed: " + e.getMessage(), e); throw new RuntimeException(e); } } From 0947f0c013e05d07fb382cc66503d1d8b78dccad Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 2 Apr 2024 17:41:47 +0100 Subject: [PATCH 030/121] Update boolean schema tests Tests for Schema.getAdditionalPropertiesBoolean and getAdditionalPropertiesSchema. --- .../openapi/tck/ModelConstructionTest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index af63cb2d..ab076716 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -999,16 +999,23 @@ public void schemaTest() { checkSameObject(ap, s.getAdditionalPropertiesSchema()); assertEquals(s.getAdditionalPropertiesBoolean(), null, "AdditionalProperties (Boolean type) is expected to be null"); + checkSameObject(s, s.additionalPropertiesBoolean(Boolean.TRUE)); assertEquals(s.getAdditionalPropertiesBoolean(), Boolean.TRUE, "AdditionalProperties (Boolean type) is expected to be true"); - assertEquals(s.getAdditionalPropertiesSchema(), null, - "AdditionalProperties (Schema type) is expected to be null"); + Schema s2 = s.getAdditionalPropertiesSchema(); + assertNotNull(s2, "AdditionalProperties (Schema type) is expected to be non-null"); + assertEquals(s2.getBooleanSchema(), Boolean.TRUE, + "AdditionalProperties (Schema type) is expected to return a boolean-true schema"); + s.setAdditionalPropertiesBoolean(Boolean.FALSE); assertEquals(s.getAdditionalPropertiesBoolean(), Boolean.FALSE, "AdditionalProperties (Boolean type) is expected to be false"); - assertEquals(s.getAdditionalPropertiesSchema(), null, - "AdditionalProperties (Schema type) is expected to be null"); + s2 = s.getAdditionalPropertiesSchema(); + assertNotNull(s2, "AdditionalProperties (Schema type) is expected to be non-null"); + assertEquals(s2.getBooleanSchema(), Boolean.FALSE, + "AdditionalProperties (Schema type) is expected to return a boolean-false schema"); + s.setAdditionalPropertiesSchema(null); assertEquals(s.getAdditionalPropertiesBoolean(), null, "AdditionalProperties (Boolean type) is expected to be null"); From 56d5a85827b7aa12f6e7f94b441115badaa99cda Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 2 Apr 2024 17:43:03 +0100 Subject: [PATCH 031/121] Set constructible properties back to null This avoids conflicts between mutually exclusive properties now present in Schema. If setBooleanSchema is called with a non-null value, other methods may fail. --- .../eclipse/microprofile/openapi/tck/ModelConstructionTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index ab076716..433ac413 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -1531,6 +1531,7 @@ private void processConstructibleProperty(Constructible o, Property p, Class "\" is expected to be equal to the value that was set."); } } + p.invokeSetter(o, null); } // Returns instances for testing getter, setter and builder methods. From 0f363150ffa052d60bd9dbcdedb6fcb3bfcd68b4 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 2 Apr 2024 17:53:13 +0100 Subject: [PATCH 032/121] Remove use of wrapper-type constructors These constructors are deprecated and cause problems when the model tests call assertSameInstance. --- .../openapi/tck/ModelConstructionTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index 433ac413..9d1c88bd 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -1554,21 +1554,21 @@ private Object getInstanceOf(Class clazz, boolean alternateEnumValue) { } else if (clazz == String.class) { return new String("value"); } else if (clazz == Boolean.class || clazz == Boolean.TYPE) { - return new Boolean(true); + return Boolean.valueOf(true); } else if (clazz == Byte.class || clazz == Byte.TYPE) { - return new Byte((byte) 1); + return Byte.valueOf((byte) 1); } else if (clazz == Short.class || clazz == Short.TYPE) { - return new Short((short) 1); + return Short.valueOf((short) 1); } else if (clazz == Integer.class || clazz == Integer.TYPE) { - return new Integer(1); + return Integer.valueOf(1); } else if (clazz == Long.class || clazz == Long.TYPE) { - return new Long(1L); + return Long.valueOf(1L); } else if (clazz == Float.class || clazz == Float.TYPE) { - return new Float(1); + return Float.valueOf(1); } else if (clazz == Double.class || clazz == Double.TYPE) { - return new Double(1); + return Double.valueOf(1); } else if (clazz == Character.class || clazz == Character.TYPE) { - return new Character('a'); + return Character.valueOf('a'); } else if (clazz == BigInteger.class) { return new BigInteger("1"); } else if (clazz == BigDecimal.class) { From 6b6e181e3c217c5179273a34c0fc4a5c7891f09b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 3 Apr 2024 15:17:11 +0100 Subject: [PATCH 033/121] TCKs for new Schema List and Map properties --- .../openapi/tck/ModelConstructionTest.java | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index 9d1c88bd..1dba83f5 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -1131,7 +1131,91 @@ public void schemaTest() { checkListEntry(s.getRequired(), required); final String otherRequiredValue = new String("otherRequired"); - checkListImmutable(s, Schema::getEnumeration, otherRequiredValue); + checkListImmutable(s, Schema::getRequired, otherRequiredValue); + + final String dependentSchemaKey = "myDependentSchemaKey"; + final Schema dependentSchemaValue = createConstructibleInstance(Schema.class); + checkSameObject(s, s.addDependentSchema(dependentSchemaKey, dependentSchemaValue)); + checkMapEntry(s.getDependentSchemas(), dependentSchemaKey, dependentSchemaValue); + assertEquals(s.getDependentSchemas().size(), 1, "The map is expected to contain one entry."); + s.removeDependentSchema(dependentSchemaKey); + assertEquals(s.getDependentSchemas().size(), 0, "The map is expected to be empty."); + + final String dependentSchemaKey2 = "myDependentSchemaKey2"; + final Schema dependentSchemaValue2 = createConstructibleInstance(Schema.class); + s.setDependentSchemas(Collections.singletonMap(dependentSchemaKey2, dependentSchemaValue2)); + checkMapEntry(s.getDependentSchemas(), dependentSchemaKey2, dependentSchemaValue2); + assertEquals(s.getDependentSchemas().size(), 1, "The map is expected to contain one entry."); + checkSameObject(s, s.addDependentSchema(dependentSchemaKey, dependentSchemaValue)); + checkMapEntry(s.getDependentSchemas(), dependentSchemaKey, dependentSchemaValue); + assertEquals(s.getDependentSchemas().size(), 2, "The map is expected to contain two entries."); + + final Schema otherDependentSchemaValue = createConstructibleInstance(Schema.class); + checkMapImmutable(s, Schema::getDependentSchemas, "otherDependentSchemaKey", otherDependentSchemaValue); + checkNullValueInAdd(s::getDependentSchemas, s::addDependentSchema, "otherDependentSchemaKey", + dependentSchemaValue); + + final Schema prefixItem = createConstructibleInstance(Schema.class); + checkSameObject(s, s.addPrefixItem(prefixItem)); + checkListEntry(s.getPrefixItems(), prefixItem); + assertEquals(s.getPrefixItems().size(), 1, "The list is expected to contain one entry."); + s.removePrefixItem(prefixItem); + assertEquals(s.getPrefixItems().size(), 0, "The list is expected to be empty."); + + final Schema prefixItem2 = createConstructibleInstance(Schema.class); + s.setPrefixItems(Collections.singletonList(prefixItem2)); + assertEquals(s.getPrefixItems().size(), 1, "The list is expected to contain one entry."); + checkListEntry(s.getPrefixItems(), prefixItem2); + checkSameObject(s, s.addPrefixItem(prefixItem)); + assertEquals(s.getPrefixItems().size(), 2, "The list is expected to contain two entries."); + checkListEntry(s.getPrefixItems(), prefixItem); + + final Schema otherPrefixItemValue = createConstructibleInstance(Schema.class); + checkListImmutable(s, Schema::getPrefixItems, otherPrefixItemValue); + + final String patternPropertyKey = "myPatternPropertyKey"; + final Schema patternPropertyValue = createConstructibleInstance(Schema.class); + checkSameObject(s, s.addPatternProperty(patternPropertyKey, patternPropertyValue)); + checkMapEntry(s.getPatternProperties(), patternPropertyKey, patternPropertyValue); + assertEquals(s.getPatternProperties().size(), 1, "The map is expected to contain one entry."); + s.removePatternProperty(patternPropertyKey); + assertEquals(s.getPatternProperties().size(), 0, "The map is expected to be empty."); + + final String patternPropertyKey2 = "myPatternPropertyKey2"; + final Schema patternPropertyValue2 = createConstructibleInstance(Schema.class); + s.setPatternProperties(Collections.singletonMap(patternPropertyKey2, patternPropertyValue2)); + checkMapEntry(s.getPatternProperties(), patternPropertyKey2, patternPropertyValue2); + assertEquals(s.getPatternProperties().size(), 1, "The map is expected to contain one entry."); + checkSameObject(s, s.addPatternProperty(patternPropertyKey, patternPropertyValue)); + checkMapEntry(s.getPatternProperties(), patternPropertyKey, patternPropertyValue); + assertEquals(s.getPatternProperties().size(), 2, "The map is expected to contain two entries."); + + final Schema otherPatternPropertyValue = createConstructibleInstance(Schema.class); + checkMapImmutable(s, Schema::getPatternProperties, "otherPatternPropertyKey", otherPatternPropertyValue); + checkNullValueInAdd(s::getPatternProperties, s::addPatternProperty, "otherPatternPropertyKey", + patternPropertyValue); + + final String dependentRequiredKey = "myDependentRequiredKey"; + final List dependentRequiredValue = Collections.singletonList("myDependentRequired"); + checkSameObject(s, s.addDependentRequired(dependentRequiredKey, dependentRequiredValue)); + checkMapEntry(s.getDependentRequired(), dependentRequiredKey, dependentRequiredValue); + assertEquals(s.getDependentRequired().size(), 1, "The map is expected to contain one entry."); + s.removeDependentRequired(dependentRequiredKey); + assertEquals(s.getDependentRequired().size(), 0, "The map is expected to be empty."); + + final String dependentRequiredKey2 = "myDependentRequiredKey2"; + final List dependentRequiredValue2 = Collections.singletonList("myDependentRequired2"); + s.setDependentRequired(Collections.singletonMap(dependentRequiredKey2, dependentRequiredValue2)); + checkMapEntry(s.getDependentRequired(), dependentRequiredKey2, dependentRequiredValue2); + assertEquals(s.getDependentRequired().size(), 1, "The map is expected to contain one entry."); + checkSameObject(s, s.addDependentRequired(dependentRequiredKey, dependentRequiredValue)); + checkMapEntry(s.getDependentRequired(), dependentRequiredKey, dependentRequiredValue); + assertEquals(s.getDependentRequired().size(), 2, "The map is expected to contain two entries."); + + final List otherDependentRequiredValue = Collections.singletonList("myOtherDependentRequired"); + checkMapImmutable(s, Schema::getDependentRequired, "otherDependentRequiredKey", otherDependentRequiredValue); + checkNullValueInAdd(s::getDependentRequired, s::addDependentRequired, "otherDependentRequiredKey", + dependentRequiredValue); } @Test From 98a9e754f795ff7496e7e15ce4a5ce2ca8f069a6 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 3 Apr 2024 17:35:52 +0100 Subject: [PATCH 034/121] Schema model: tests for examples and example Test that example and examples do not affect each other. --- .../openapi/tck/ModelConstructionTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index 1dba83f5..4e8fe145 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -20,6 +20,7 @@ // import static org.testng.Assert.assertNotSame; // import static org.testng.Assert.assertSame; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.sameInstance; import static org.testng.Assert.assertEquals; @@ -1022,6 +1023,17 @@ public void schemaTest() { assertEquals(s.getAdditionalPropertiesSchema(), null, "AdditionalProperties (Schema type) is expected to be null"); + s.setExamples(null); + s.setExample("example1"); + assertEquals(s.getExample(), "example1", "Example is expected to be set"); + assertNull(s.getExamples(), "Examples should be null"); + s.setExamples(Arrays.asList("example2", "example3")); + assertEquals(s.getExample(), "example1", "Example should not be affected by settings examples"); + assertThat("Examples should be set", s.getExamples(), contains("example2", "example3")); + s.setExample("example4"); + assertEquals(s.getExample(), "example4", "Example should be set"); + assertThat("Examples should not be affected by example", s.getExamples(), contains("example2", "example3")); + final Schema allOf = createConstructibleInstance(Schema.class); checkSameObject(s, s.addAllOf(allOf)); checkListEntry(s.getAllOf(), allOf); From 26be717c7b013c0289d55b23631ca4bba56d5d7c Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 3 Apr 2024 17:37:37 +0100 Subject: [PATCH 035/121] Schema model: TCKs for property access by name --- .../openapi/tck/ModelConstructionTest.java | 198 ++++++++++++++++++ 1 file changed, 198 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index 4e8fe145..dd736060 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -20,7 +20,9 @@ // import static org.testng.Assert.assertNotSame; // import static org.testng.Assert.assertSame; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.anEmptyMap; import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.sameInstance; import static org.testng.Assert.assertEquals; @@ -41,6 +43,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Supplier; @@ -991,6 +994,7 @@ public void mediaTypeTest() { checkNullValueInAdd(mt::getExamples, mt::addExample, "otherExample", exampleValue); } + @SuppressWarnings("deprecation") // Testing deprecated Schema methods @Test public void schemaTest() { final Schema s = processConstructible(Schema.class); @@ -1230,6 +1234,200 @@ public void schemaTest() { dependentRequiredValue); } + @SuppressWarnings("deprecation") // Testing deprecated Schema methods + @Test + public void testSchemaArbitraryProperties() { + Schema s = createConstructibleInstance(Schema.class); + + testSchemaProperty(s, "discriminator", Schema::getDiscriminator, Schema::setDiscriminator, + createConstructibleInstance(Discriminator.class)); + testSchemaProperty(s, "title", Schema::getTitle, Schema::setTitle, "test title"); + testSchemaProperty(s, "default", Schema::getDefaultValue, Schema::setDefaultValue, "test"); + testSchemaListProperty(s, "enum", Schema::getEnumeration, Schema::setEnumeration, "a"); + testSchemaProperty(s, "multipleOf", Schema::getMultipleOf, Schema::setMultipleOf, new BigDecimal("3")); + testSchemaProperty(s, "maximum", Schema::getMaximum, Schema::setMaximum, new BigDecimal("3")); + testSchemaProperty(s, "exclusiveMaximum", Schema::getExclusiveMaximum, Schema::setExclusiveMaximum, + new BigDecimal("3")); + testSchemaProperty(s, "minimum", Schema::getMinimum, Schema::setMinimum, new BigDecimal("3")); + testSchemaProperty(s, "exclusiveMinimum", Schema::getExclusiveMinimum, Schema::setExclusiveMinimum, + new BigDecimal("3")); + testSchemaProperty(s, "maxLength", Schema::getMaxLength, Schema::setMaxLength, 17); + testSchemaProperty(s, "minLength", Schema::getMinLength, Schema::setMinLength, 5); + testSchemaProperty(s, "pattern", Schema::getPattern, Schema::setPattern, "[a-z]+"); + testSchemaProperty(s, "maxItems", Schema::getMaxItems, Schema::setMaxItems, 5); + testSchemaProperty(s, "minItems", Schema::getMinItems, Schema::setMinItems, 3); + testSchemaProperty(s, "uniqueItems", Schema::getUniqueItems, Schema::setUniqueItems, true); + testSchemaProperty(s, "maxProperties", Schema::getMaxProperties, Schema::setMaxProperties, 10); + testSchemaProperty(s, "minProperties", Schema::getMinProperties, Schema::setMinProperties, 8); + testSchemaListProperty(s, "required", Schema::getRequired, Schema::setRequired, "propName"); + testSchemaListProperty(s, "type", Schema::getType, Schema::setType, Schema.SchemaType.OBJECT); + testSchemaProperty(s, "not", Schema::getNot, Schema::setNot, createConstructibleInstance(Schema.class)); + testSchemaMapProperty(s, "properties", Schema::getProperties, Schema::setProperties, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "additionalProperties", Schema::getAdditionalPropertiesSchema, + Schema::setAdditionalPropertiesSchema, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "description", Schema::getDescription, Schema::setDescription, "test schema"); + testSchemaProperty(s, "format", Schema::getFormat, Schema::setFormat, "date-time"); + testSchemaProperty(s, "readOnly", Schema::getReadOnly, Schema::setReadOnly, true); + testSchemaProperty(s, "writeOnly", Schema::getWriteOnly, Schema::setWriteOnly, true); + testSchemaProperty(s, "example", Schema::getExample, Schema::setExample, "test"); + testSchemaProperty(s, "externalDocs", Schema::getExternalDocs, Schema::setExternalDocs, + createConstructibleInstance(ExternalDocumentation.class)); + testSchemaProperty(s, "deprecated", Schema::getDeprecated, Schema::setDeprecated, true); + testSchemaProperty(s, "xml", Schema::getXml, Schema::setXml, createConstructibleInstance(XML.class)); + testSchemaProperty(s, "items", Schema::getItems, Schema::setItems, createConstructibleInstance(Schema.class)); + testSchemaListProperty(s, "allOf", Schema::getAllOf, Schema::setAllOf, + createConstructibleInstance(Schema.class)); + testSchemaListProperty(s, "anyOf", Schema::getAnyOf, Schema::setAnyOf, + createConstructibleInstance(Schema.class)); + testSchemaListProperty(s, "oneOf", Schema::getOneOf, Schema::setOneOf, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "$schema", Schema::getSchemaDialect, Schema::setSchemaDialect, "http://test.dialect"); + testSchemaProperty(s, "$comment", Schema::getComment, Schema::setComment, "about this schema"); + testSchemaProperty(s, "if", Schema::getIfSchema, Schema::setIfSchema, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "then", Schema::getThenSchema, Schema::setThenSchema, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "else", Schema::getElseSchema, Schema::setElseSchema, + createConstructibleInstance(Schema.class)); + testSchemaMapProperty(s, "dependentSchemas", Schema::getDependentSchemas, Schema::setDependentSchemas, + createConstructibleInstance(Schema.class)); + testSchemaListProperty(s, "prefixItems", Schema::getPrefixItems, Schema::setPrefixItems, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "contains", Schema::getContains, Schema::setContains, + createConstructibleInstance(Schema.class)); + testSchemaMapProperty(s, "patternProperties", Schema::getPatternProperties, Schema::setPatternProperties, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "propertyNames", Schema::getPropertyNames, Schema::setPropertyNames, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "unevaluatedItems", Schema::getUnevaluatedItems, Schema::setUnevaluatedItems, + createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "unevaluatedProperties", Schema::getUnevaluatedProperties, + Schema::setUnevaluatedProperties, createConstructibleInstance(Schema.class)); + testSchemaProperty(s, "const", Schema::getConstValue, Schema::setConstValue, "value"); + testSchemaProperty(s, "maxContains", Schema::getMaxContains, Schema::setMaxContains, 5); + testSchemaProperty(s, "minContains", Schema::getMinContains, Schema::setMinContains, 3); + testSchemaMapProperty(s, "dependentRequired", Schema::getDependentRequired, Schema::setDependentRequired, + Arrays.asList("a", "b")); + testSchemaProperty(s, "contentEncoding", Schema::getContentEncoding, Schema::setContentEncoding, "base64"); + testSchemaProperty(s, "contentMediaType", Schema::getContentMediaType, Schema::setContentMediaType, + "test/plain"); + testSchemaProperty(s, "contentSchema", Schema::getContentSchema, Schema::setContentSchema, + createConstructibleInstance(Schema.class)); + testSchemaListProperty(s, "examples", Schema::getExamples, Schema::setExamples, "foo"); + } + + public void testSchemaProperty(Schema testSchema, String name, Function getter, + BiConsumer setter, V testValue) { + // Set with the setter + setter.accept(testSchema, testValue); + assertSame(getter.apply(testSchema), testValue, + "Getter should return the same instance as was set for property " + name); + assertSame(testSchema.get(name), testValue, + "Generic getter should return same instance as was set for property " + name); + + // Clear with the setter + setter.accept(testSchema, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + + // Set with generic access + testSchema.set(name, testValue); + assertSame(getter.apply(testSchema), testValue, + "Getter should return the same instance as was set for property " + name); + assertSame(testSchema.get(name), testValue, + "Generic getter should return same instance as was set for property " + name); + + // Clear with generic access + testSchema.set(name, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + } + + public void testSchemaMapProperty(Schema testSchema, String name, + Function> getter, BiConsumer> setter, + V testValue) { + // Set with the setter + Map testMap = new HashMap<>(); + testMap.put("test1", testValue); + + setter.accept(testSchema, testMap); + testMapFromGetter(() -> getter.apply(testSchema), testMap, name); + testMapFromGetter(() -> testSchema.get(name), testMap, name); + + // Clear with the setter + setter.accept(testSchema, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + + // Set with generic access + testSchema.set(name, testMap); + testMapFromGetter(() -> getter.apply(testSchema), testMap, name); + testMapFromGetter(() -> testSchema.get(name), testMap, name); + + // Clear with generic access + testSchema.set(name, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + } + + private void testMapFromGetter(Supplier getter, Map expected, + String name) { + assertThat("Test error: expected may not be empty", expected, not(anEmptyMap())); + + Object actualObj = getter.get(); + assertEquals(actualObj, expected, "Getter should return value that was set for property " + name); + + // Check that all values are the same instance + Map actualMap = (Map) actualObj; + expected.forEach((k, v) -> { + assertSame(v, actualMap.get(k), + "Getter should return value with same instance for key " + v + " property " + name); + }); + } + + public void testSchemaListProperty(Schema testSchema, String name, + Function> getter, BiConsumer> setter, + V testValue) { + // Set with the setter + List testList = new ArrayList<>(); + testList.add(testValue); + + setter.accept(testSchema, testList); + testListFromGetter(() -> getter.apply(testSchema), testList, name); + testListFromGetter(() -> testSchema.get(name), testList, name); + + // Clear with the setter + setter.accept(testSchema, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + + // Set with generic access + testSchema.set(name, testList); + testListFromGetter(() -> getter.apply(testSchema), testList, name); + testListFromGetter(() -> testSchema.get(name), testList, name); + + // Clear with generic access + testSchema.set(name, null); + assertNull(getter.apply(testSchema), "Getter should return null for property " + name); + assertNull(testSchema.get(name), "Generic access should return null for property " + name); + } + + private void testListFromGetter(Supplier getter, List expected, String name) { + assertThat("Test error: expected may not be empty", expected, not(empty())); + + Object actualObj = getter.get(); + assertEquals(actualObj, expected, "Getter should return value that was set for property " + name); + + // Check that all values are the same instance + List actualList = (List) actualObj; + expected.forEach((expectedV) -> { + assertTrue(actualList.stream().anyMatch((actualV) -> expectedV == actualV), + "Getter should return value containing " + expectedV + " for property " + name); + }); + } + @Test public void xmlTest() { processConstructible(XML.class); From 08957ed49a4373024bb7391b7a35f9bc2913e08b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 5 Apr 2024 14:58:40 +0100 Subject: [PATCH 036/121] Model TCK: Remove use of deprecated Schema.type --- .../openapi/reader/MyOASModelReaderImpl.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 4769b233..e8d89f11 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -90,16 +90,16 @@ public OpenAPI buildModel() { .components(OASFactory.createObject(Components.class) .schemas(new HashMap()) .addSchema("Bookings", OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.INTEGER) + .addType(Schema.SchemaType.INTEGER) .title("Bookings") .ref("#/components.schemas.Booking")) .addSchema("Airlines", OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.INTEGER) + .addType(Schema.SchemaType.INTEGER) .title("Airlines")) .addSchema("AirlinesRef", OASFactory.createObject(Schema.class) .ref("#/components/schemas/Airlines")) .addSchema("id", OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.INTEGER) + .addType(Schema.SchemaType.INTEGER) .format("int32")) .responses(new HashMap()) .addResponse("FoundAirlines", OASFactory.createObject(APIResponse.class) @@ -107,13 +107,13 @@ public OpenAPI buildModel() { .content(OASFactory.createObject(Content.class) .addMediaType("application/json", OASFactory.createObject(MediaType.class) .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.ARRAY))))) + .addType(Schema.SchemaType.ARRAY))))) .addResponse("FoundBookings", OASFactory.createObject(APIResponse.class) .description("Bookings retrieved") .content(OASFactory.createObject(Content.class) .addMediaType("application/json", OASFactory.createObject(MediaType.class) .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.ARRAY) + .addType(Schema.SchemaType.ARRAY) .ref("#/components.schemas.Booking"))))) .parameters(new HashMap()) .addParameter("departureDate", OASFactory.createObject(Parameter.class) @@ -144,14 +144,14 @@ public OpenAPI buildModel() { .addHeader("Max-Rate", OASFactory.createObject(Header.class) .description("Maximum rate") .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.INTEGER)) + .addType(Schema.SchemaType.INTEGER)) .required(true) .allowEmptyValue(true) .deprecated(true)) .addHeader("Request-Limit", OASFactory.createObject(Header.class) .description("The number of allowed requests in the current period") .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.INTEGER))) + .addType(Schema.SchemaType.INTEGER))) .securitySchemes(new HashMap()) .addSecurityScheme("httpTestScheme", OASFactory.createObject(SecurityScheme.class) .description("user security scheme") @@ -218,7 +218,7 @@ public OpenAPI buildModel() { .addMediaType("application/json", OASFactory .createObject(MediaType.class) .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.ARRAY) + .addType(Schema.SchemaType.ARRAY) .ref("#/components.schemas.Flight"))))) .addAPIResponse("404", OASFactory.createObject(APIResponse.class) .description("No available flights found") @@ -235,7 +235,7 @@ public OpenAPI buildModel() { .allowEmptyValue(true) .description("Airport the customer departs from") .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.STRING))) + .addType(Schema.SchemaType.STRING))) .addParameter(OASFactory.createObject(Parameter.class) .name("returningDate") .required(true) @@ -243,14 +243,14 @@ public OpenAPI buildModel() { .allowReserved(true) .description("Customer return date") .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.STRING))) + .addType(Schema.SchemaType.STRING))) .addParameter(OASFactory.createObject(Parameter.class) .name("airportTo") .required(true) .in(Parameter.In.QUERY) .description("Airport the customer returns to") .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.STRING))) + .addType(Schema.SchemaType.STRING))) .addParameter(OASFactory.createObject(Parameter.class) .name("numberOfAdults") .required(true) @@ -258,7 +258,7 @@ public OpenAPI buildModel() { .description("Number of adults on the flight") .schema(OASFactory.createObject(Schema.class) .minimum(new BigDecimal(0)) - .type(Schema.SchemaType.STRING))) + .addType(Schema.SchemaType.STRING))) .addParameter(OASFactory.createObject(Parameter.class) .name("numberOfChildren") .required(true) @@ -267,7 +267,7 @@ public OpenAPI buildModel() { .description("Number of children on the flight") .schema(OASFactory.createObject(Schema.class) .minimum(new BigDecimal(0)) - .type(Schema.SchemaType.STRING))))) + .addType(Schema.SchemaType.STRING))))) .addPathItem("/modelReader/bookings", OASFactory.createObject(PathItem.class) .GET(OASFactory.createObject(Operation.class) .tags(new ArrayList()) @@ -281,7 +281,7 @@ public OpenAPI buildModel() { .addMediaType("applictaion/json", OASFactory .createObject(MediaType.class) .schema(OASFactory.createObject(Schema.class) - .type(Schema.SchemaType.ARRAY) + .addType(Schema.SchemaType.ARRAY) .ref("#/components.schemas.Booking"))))) .addAPIResponse("404", OASFactory.createObject(APIResponse.class) .description("No bookings found for the user")))) @@ -304,6 +304,7 @@ public OpenAPI buildModel() { .schema(OASFactory.createObject(Schema.class) .title("id") .description("id of the new booking") - .type(Schema.SchemaType.STRING))))))))); + .addType( + Schema.SchemaType.STRING))))))))); } } From 3a835a46e5c24a59f61f7c8c49c108fbe2a86fd4 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 5 Apr 2024 15:29:29 +0100 Subject: [PATCH 037/121] Schema model: remove type and nullable methods --- .../openapi/models/media/Schema.java | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index b7b686dd..6a7e45bb 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -644,31 +644,6 @@ default Schema type(List types) { */ void removeType(SchemaType type); - /** - * Sets the type property of this Schema instance to a single type. - * - * @param type - * the required type - * @since "4.0" - * @deprecated use {@link #setType(List)} - */ - @Deprecated(since = "4.0") - void setType(SchemaType type); - - /** - * Sets the type property of this Schema instance to a single type. - * - * @param type - * the required type - * @return the current Schema instance - * @deprecated use {@link #setType(List)} - */ - @Deprecated(since = "4.0") - default Schema type(SchemaType type) { - setType(type); - return this; - } - /** * Returns a Schema which describes properties not allowed in objects defined by the current schema. * @@ -893,41 +868,6 @@ default Schema format(String format) { return this; } - /** - * Returns whether the type property allows the object to be {@code null} - * - * @return whether null is allowed - * @deprecated use {@link #getType()} and check if the result contains {@link SchemaType#NULL} - */ - @Deprecated(since = "4.0") - Boolean getNullable(); - - /** - * Updates the type property to either permit or disallow {@code null} - * - * @param nullable - * a boolean value indicating whether this Schema allows a null value. - * @deprecated use {@link #setType(List)}, {@link #addType(SchemaType)}, or {@link #removeType(SchemaType)} to add - * or remove {@link SchemaType#NULL} - */ - @Deprecated(since = "4.0") - void setNullable(Boolean nullable); - - /** - * Sets the nullable property of this Schema instance. Specify true if this Schema will allow null values. - * - * @param nullable - * a boolean value indicating this Schema allows a null value. - * @return the current Schema instance - * @deprecated use {@link #setType(List)}, {@link #addType(SchemaType)}, or {@link #removeType(SchemaType)} to add - * or remove {@link SchemaType#NULL} - */ - @Deprecated(since = "4.0") - default Schema nullable(Boolean nullable) { - setNullable(nullable); - return this; - } - /** * Returns the readOnly property from this Schema instance. * From c0eccb814c9fa6fc333e8a68ce9386645e065502 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 22 Apr 2024 11:30:07 +0100 Subject: [PATCH 038/121] TCK for a custom schema dialect Test building a schema with a custom dialect in a model reader and ensure it is serialized correctly. --- .../openapi/reader/MyOASModelReaderImpl.java | 61 +++++++++++++++++++ .../openapi/tck/ModelReaderAppTest.java | 49 +++++++++++++++ .../openapi/tck/utils/TCKMatchers.java | 55 +++++++++++++++++ 3 files changed, 165 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index e8d89f11..45ce98a3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -15,9 +15,14 @@ */ package org.eclipse.microprofile.openapi.reader; +import static java.util.Collections.emptyMap; + import java.math.BigDecimal; +import java.math.BigInteger; +import java.time.DayOfWeek; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import org.eclipse.microprofile.openapi.OASFactory; @@ -38,11 +43,13 @@ import org.eclipse.microprofile.openapi.models.media.MediaType; import org.eclipse.microprofile.openapi.models.media.Schema; import org.eclipse.microprofile.openapi.models.parameters.Parameter; +import org.eclipse.microprofile.openapi.models.parameters.Parameter.In; import org.eclipse.microprofile.openapi.models.parameters.RequestBody; import org.eclipse.microprofile.openapi.models.responses.APIResponse; import org.eclipse.microprofile.openapi.models.responses.APIResponses; import org.eclipse.microprofile.openapi.models.security.SecurityRequirement; import org.eclipse.microprofile.openapi.models.security.SecurityScheme; +import org.eclipse.microprofile.openapi.models.security.SecurityScheme.Type; import org.eclipse.microprofile.openapi.models.servers.Server; import org.eclipse.microprofile.openapi.models.servers.ServerVariable; import org.eclipse.microprofile.openapi.models.tags.Tag; @@ -101,6 +108,60 @@ public OpenAPI buildModel() { .addSchema("id", OASFactory.createObject(Schema.class) .addType(Schema.SchemaType.INTEGER) .format("int32")) + .addSchema("custom", OASFactory.createSchema() + .schemaDialect("http://example.com/myCustomSchema") + .set("shortKey", (short) 1) + .set("intKey", 2) + .set("longKey", 3L) + .set("booleanKey", true) + .set("charKey", 'a') + .set("stringKey", "string") + .set("floatKey", 3.5f) + .set("doubleKey", 3.5d) + .set("bigDecimalKey", new BigDecimal("3.5")) + .set("bigIntegerKey", new BigInteger("7")) + .set("extDocKey", OASFactory.createExternalDocumentation().description("test")) + .set("operationKey", OASFactory.createOperation().description("test")) + .set("pathItemKey", OASFactory.createPathItem().description("test")) + .set("pathsKey", OASFactory.createPaths() + .addPathItem("test", OASFactory.createPathItem().description("test"))) + .set("callbackKey", OASFactory.createCallback() + .addPathItem("test", OASFactory.createPathItem().description("test"))) + .set("exampleKey", OASFactory.createExample().value("test")) + .set("headerKey", OASFactory.createHeader().description("test")) + .set("contactKey", OASFactory.createContact().name("test")) + .set("infoKey", OASFactory.createInfo().title("test").version("1.0")) + .set("licenseKey", OASFactory.createLicense().name("test")) + .set("linkKey", OASFactory.createLink().operationId("getTestFlights")) + .set("contentKey", OASFactory.createContent() + .addMediaType("test", OASFactory.createMediaType().example("test"))) + .set("discriminatorKey", OASFactory.createDiscriminator().propertyName("test")) + .set("schemaKey", OASFactory.createSchema().title("test")) + .set("xmlKey", OASFactory.createXML().name("test")) + .set("parameterKey", OASFactory.createParameter().name("test").in(In.PATH)) + .set("requestBodyKey", OASFactory.createRequestBody() + .content(OASFactory.createContent() + .addMediaType("test", OASFactory.createMediaType().example("test")))) + .set("apiResponseKey", OASFactory.createAPIResponse().description("test")) + .set("apiResponsesKey", OASFactory.createAPIResponses() + .addAPIResponse("200", OASFactory.createAPIResponse().description("test"))) + .set("oAuthFlowKey", + OASFactory.createOAuthFlow().authorizationUrl("http://example.com")) + .set("oAuthFlowsKey", OASFactory.createOAuthFlows().implicit( + OASFactory.createOAuthFlow().authorizationUrl("http://example.com") + .scopes(emptyMap()))) + .set("securityReqKey", OASFactory.createSecurityRequirement().addScheme("test")) + .set("securitySchemeKey", OASFactory.createSecurityScheme() + .type(Type.HTTP) + .scheme("Basic")) + .set("serverKey", OASFactory.createServer().url("http://example.com")) + .set("serverVarKey", OASFactory.createServerVariable().defaultValue("test")) + .set("tagKey", OASFactory.createTag().name("test")) + .set("enumKey", DayOfWeek.MONDAY) + .set("listKey", Arrays.asList( + "test", + OASFactory.createXML().name("test"))) + .set("mapKey", Collections.singletonMap("test", DayOfWeek.THURSDAY))) .responses(new HashMap()) .addResponse("FoundAirlines", OASFactory.createObject(APIResponse.class) .description("successfully found airlines") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index 6b240cb5..7c638c72 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -17,11 +17,14 @@ package org.eclipse.microprofile.openapi.tck; import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.number; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.equalToIgnoringCase; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.hasSize; @@ -218,6 +221,52 @@ public void testSchema(String type) { equalTo("id of the new booking")); } + @Test(dataProvider = "formatProvider") + public void testSchemaCustomProperties(String type) { + ValidatableResponse vr = callEndpoint(type); + vr.body("components.schemas.custom.$schema", equalTo("http://example.com/myCustomSchema")); + vr.body("components.schemas.custom.shortKey", number(1)); + vr.body("components.schemas.custom.intKey", number(2)); + vr.body("components.schemas.custom.longKey", number(3)); + vr.body("components.schemas.custom.booleanKey", equalTo(true)); + vr.body("components.schemas.custom.charKey", equalTo("a")); + vr.body("components.schemas.custom.stringKey", equalTo("string")); + vr.body("components.schemas.custom.floatKey", number(3.5)); + vr.body("components.schemas.custom.doubleKey", number(3.5)); + vr.body("components.schemas.custom.bigDecimalKey", number(3.5)); + vr.body("components.schemas.custom.bigIntegerKey", number(7)); + vr.body("components.schemas.custom.extDocKey.description", equalTo("test")); + vr.body("components.schemas.custom.operationKey.description", equalTo("test")); + vr.body("components.schemas.custom.pathItemKey.description", equalTo("test")); + vr.body("components.schemas.custom.pathsKey.test.description", equalTo("test")); + vr.body("components.schemas.custom.callbacKey.description", equalTo("test")); + vr.body("components.schemas.custom.exampleKey.value", equalTo("test")); + vr.body("components.schemas.custom.headerKey.description", equalTo("test")); + vr.body("components.schemas.custom.contactKey.name", equalTo("test")); + vr.body("components.schemas.custom.infoKey.title", equalTo("test")); + vr.body("components.schemas.custom.licenseKey.name", equalTo("test")); + vr.body("components.schemas.custom.linkKey.operationId", equalTo("test")); + vr.body("components.schemas.custom.contentKey.test.example", equalTo("test")); + vr.body("components.schemas.custom.discriminatorKey.propertyName", equalTo("test")); + vr.body("components.schemas.custom.schemaKey.title", equalTo("test")); + vr.body("components.schemas.custom.xmlKey.name", equalTo("test")); + vr.body("components.schemas.custom.parameterKey.name", equalTo("test")); + vr.body("components.schemas.custom.requestBodyKey.content.test.example", equalTo("test")); + vr.body("components.schemas.custom.apiResponseKey.description", equalTo("test")); + vr.body("components.schemas.custom.apiResponsesKey.200.description", equalTo("test")); + vr.body("components.schemas.custom.oAuthFlowKey.authorizationUrl", equalTo("http://example.com")); + vr.body("components.schemas.custom.oAuthFlowsKey.implicit.authorizationUrl", equalTo("http://example.com")); + vr.body("components.schemas.custom.securityReqKey.scheme", contains("test")); + vr.body("components.schemas.custom.securitySchemeKey.type", equalTo("http")); + vr.body("components.schemas.custom.serverKey.url", equalTo("http://example.com")); + vr.body("components.schemas.custom.serverVarKey.default", equalTo("test")); + vr.body("components.schemas.custom.tagKey.name", equalTo("test")); + vr.body("components.schemas.custom.enumKey", equalToIgnoringCase("MONDAY")); + vr.body("components.schemas.custom.listKey", hasItem("test")); + vr.body("components.schemas.custom.listKey.name", hasItem("test")); + vr.body("components.schemas.custom.mapKey.test", equalToIgnoringCase("MONDAY")); + } + @Test(dataProvider = "formatProvider") public void testExampleObject(String type) { ValidatableResponse vr = callEndpoint(type); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java index 68047270..61e12070 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java @@ -19,6 +19,7 @@ import static org.hamcrest.comparator.ComparatorMatcherBuilder.comparedBy; import java.math.BigDecimal; +import java.math.BigInteger; import java.util.Collection; import java.util.Comparator; @@ -82,6 +83,20 @@ public static Matcher itemOrSingleton(Object item) { return itemOrSingleton(equalTo(item)); } + /** + * Creates a matcher which matches numbers based on their numeric value without considering their type. + *

+ * Both the expected and actual value are converted to {@link BigDecimal} and compared using + * {@link BigDecimal#compareTo(BigDecimal) compareTo}. + * + * @param number + * the expected number + * @return the matcher + */ + public static Matcher number(Number number) { + return new NumericEqualityMatcher(number); + } + public static class ItemOrSingletonMatcher extends TypeSafeDiagnosingMatcher { private Matcher baseMatcher; @@ -114,4 +129,44 @@ protected boolean matchesSafely(Object item, Description mismatchDescription) { return result; } } + + public static class NumericEqualityMatcher extends TypeSafeDiagnosingMatcher { + + private BigDecimal expected; + + public NumericEqualityMatcher(Number expected) { + this.expected = toBigDecimal(expected); + } + + @Override + public void describeTo(Description desc) { + desc.appendText("A number equal to ").appendValue(expected); + } + + @Override + protected boolean matchesSafely(Number item, Description mismatchDescription) { + BigDecimal actual = toBigDecimal(item); + mismatchDescription.appendText("was: ").appendValue(item); + return expected.compareTo(actual) == 0; + } + + private static BigDecimal toBigDecimal(Number number) { + if (number instanceof Integer) { + return new BigDecimal((Integer) number); + } else if (number instanceof Short) { + return new BigDecimal((Short) number); + } else if (number instanceof Long) { + return new BigDecimal((Long) number); + } else if (number instanceof Float) { + return new BigDecimal((Float) number); + } else if (number instanceof Double) { + return new BigDecimal((Double) number); + } else if (number instanceof BigInteger) { + return new BigDecimal((BigInteger) number); + } else { + return new BigDecimal(number.doubleValue()); + } + } + + } } From e959eb49b66c42adfd1e7b902c560d8330b143ca Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 22 Apr 2024 16:39:35 +0100 Subject: [PATCH 039/121] Test custom schema dialect in a static document --- .../tck/StaticDocumentCustomDialectTest.java | 51 +++++++++++++++++++ tck/src/main/resources/customDialect.yaml | 31 +++++++++++ 2 files changed, 82 insertions(+) create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentCustomDialectTest.java create mode 100644 tck/src/main/resources/customDialect.yaml diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentCustomDialectTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentCustomDialectTest.java new file mode 100644 index 00000000..e4ec2f46 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentCustomDialectTest.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.tck; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.startsWith; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.testng.annotations.Test; + +import io.restassured.response.ValidatableResponse; + +/** + * Test that a static document can contain a schema with a custom dialect + */ +public class StaticDocumentCustomDialectTest extends AppTestBase { + + @Deployment(name = "customdialect", testable = false) + public static WebArchive createDeployment() { + return ShrinkWrap.create(WebArchive.class, "customdialect.war") + .addAsManifestResource("customDialect.yaml", "openapi.yaml"); + } + + @Test(dataProvider = "formatProvider") + public void testStaticDocumentCustomDialect(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("openapi", startsWith("3.1.")); + + final String schemaPath = "paths.'/test'.get.responses.'200'.content.'application/json'.schema"; + vr.body(schemaPath + ".$schema", equalTo("http://example.com/custom")); + vr.body(schemaPath + ".foo", equalTo("bar")); + vr.body(schemaPath + ".baz", equalTo("qux")); + } + +} diff --git a/tck/src/main/resources/customDialect.yaml b/tck/src/main/resources/customDialect.yaml new file mode 100644 index 00000000..e6d80a43 --- /dev/null +++ b/tck/src/main/resources/customDialect.yaml @@ -0,0 +1,31 @@ +# Copyright (c) 2024 Contributors to the Eclipse Foundation +#

+# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#

+# http://www.apache.org/licenses/LICENSE-2.0 +#

+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +openapi: 3.1.0 +info: + title: Custom dialect schema example + version: 1.0.0 +paths: + /test: + get: + description: Returns data in a custom schema dialect + responses: + '200': + content: + application/json: + schema: + $schema: http://example.com/custom + description: This is an example of a completely custom schema which should be passed through untouched + foo: bar + baz: qux \ No newline at end of file From 72f6b2652e2e21b58bbd2a89bda23577954d3cdd Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 25 Apr 2024 15:12:50 +0100 Subject: [PATCH 040/121] Fix mistakes in custom schema model test --- .../microprofile/openapi/tck/ModelReaderAppTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index 7c638c72..1dc34a99 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -22,6 +22,7 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalToIgnoringCase; import static org.hamcrest.Matchers.hasItem; @@ -239,13 +240,13 @@ public void testSchemaCustomProperties(String type) { vr.body("components.schemas.custom.operationKey.description", equalTo("test")); vr.body("components.schemas.custom.pathItemKey.description", equalTo("test")); vr.body("components.schemas.custom.pathsKey.test.description", equalTo("test")); - vr.body("components.schemas.custom.callbacKey.description", equalTo("test")); + vr.body("components.schemas.custom.callbackKey.test.description", equalTo("test")); vr.body("components.schemas.custom.exampleKey.value", equalTo("test")); vr.body("components.schemas.custom.headerKey.description", equalTo("test")); vr.body("components.schemas.custom.contactKey.name", equalTo("test")); vr.body("components.schemas.custom.infoKey.title", equalTo("test")); vr.body("components.schemas.custom.licenseKey.name", equalTo("test")); - vr.body("components.schemas.custom.linkKey.operationId", equalTo("test")); + vr.body("components.schemas.custom.linkKey.operationId", equalTo("getTestFlights")); vr.body("components.schemas.custom.contentKey.test.example", equalTo("test")); vr.body("components.schemas.custom.discriminatorKey.propertyName", equalTo("test")); vr.body("components.schemas.custom.schemaKey.title", equalTo("test")); @@ -256,15 +257,15 @@ public void testSchemaCustomProperties(String type) { vr.body("components.schemas.custom.apiResponsesKey.200.description", equalTo("test")); vr.body("components.schemas.custom.oAuthFlowKey.authorizationUrl", equalTo("http://example.com")); vr.body("components.schemas.custom.oAuthFlowsKey.implicit.authorizationUrl", equalTo("http://example.com")); - vr.body("components.schemas.custom.securityReqKey.scheme", contains("test")); + vr.body("components.schemas.custom.securityReqKey.test", empty()); vr.body("components.schemas.custom.securitySchemeKey.type", equalTo("http")); vr.body("components.schemas.custom.serverKey.url", equalTo("http://example.com")); vr.body("components.schemas.custom.serverVarKey.default", equalTo("test")); vr.body("components.schemas.custom.tagKey.name", equalTo("test")); vr.body("components.schemas.custom.enumKey", equalToIgnoringCase("MONDAY")); vr.body("components.schemas.custom.listKey", hasItem("test")); - vr.body("components.schemas.custom.listKey.name", hasItem("test")); - vr.body("components.schemas.custom.mapKey.test", equalToIgnoringCase("MONDAY")); + vr.body("components.schemas.custom.listKey[1].name", equalTo("test")); + vr.body("components.schemas.custom.mapKey.test", equalToIgnoringCase("THURSDAY")); } @Test(dataProvider = "formatProvider") From 92a99a767341c42b3422ea481c322b19efd6da9c Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Fri, 26 Apr 2024 09:25:50 +0100 Subject: [PATCH 041/121] Add summary attribute to Info --- .../openapi/annotations/info/Info.java | 7 +++++ .../annotations/info/package-info.java | 2 +- .../openapi/models/info/Info.java | 27 +++++++++++++++++++ .../openapi/models/info/package-info.java | 2 +- .../openapi/apps/petstore/PetStoreApp.java | 5 ++-- 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java index 5473efa2..ae0468cc 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java @@ -75,6 +75,13 @@ **/ String version(); + /** + * The summary of the API. + * + * @return the summary for the API + **/ + String summary() default ""; + /** * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.info.Info Info} model * corresponding to the containing annotation. diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/package-info.java index 0eee9c53..088d8344 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/package-info.java @@ -34,6 +34,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.1") +@org.osgi.annotation.versioning.Version("1.2") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.annotations.info; \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java index 0005a02b..984cc336 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java @@ -200,4 +200,31 @@ default Info version(String version) { return this; } + /** + * Returns the summary of the exposed API from this Info instance. + * + * @return the summary of the exposed API + **/ + String getSummary(); + + /** + * Sets this Info instance's summary information for the exposed API. + * + * @param summary + * the summary of the exposed API + */ + void setSummary(String summary); + + /** + * Sets this Info instance's summary of the API to the given summary and returns this instance of Info. + * + * @param summary + * the summary for the exposed API + * @return this Info instance + */ + default Info summary(String summary) { + setSummary(summary); + return this; + } + } \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/package-info.java index bb6bebb6..6ec0a09f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/package-info.java @@ -40,6 +40,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.0") +@org.osgi.annotation.versioning.Version("1.1") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.models.info; \ No newline at end of file diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java index ecbc9cc9..80de4891 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2017 Contributors to the Eclipse Foundation + * Copyright (c) 2017, 2024 Contributors to the Eclipse Foundation *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at @@ -38,7 +38,8 @@ url = "http://www.apache.org/licenses/LICENSE-2.0.html"), contact = @Contact(name = "PetStore API Support", url = "https://github.com/eclipse/microprofile-open-api", - email = "support@petstore.com")), + email = "support@petstore.com"), + summary = "An API for a pet store"), externalDocs = @ExternalDocumentation(url = "http://swagger.io", description = "Find out more about our store"), tags = { From 82974af7e7ef046cc5574dcd68c97da2f9ff99c4 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Fri, 26 Apr 2024 09:26:16 +0100 Subject: [PATCH 042/121] add test for summary attribute in info annotation --- .../org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java | 1 + .../org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 1 + .../org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java | 1 + 3 files changed, 3 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index a9995962..bfa1c8c5 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -73,6 +73,7 @@ info = @Info(title = "AirlinesRatingApp API", version = "1.0", description = "APIs for booking and managing air flights", termsOfService = "http://airlinesratingapp.com/terms", + summary = "An API for an Airline application", contact = @Contact(name = "AirlinesRatingApp API Support", url = "http://exampleurl.com/contact", email = "techsupport@airlinesratingapp.com", diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 96b54ecb..2efcf5d3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -69,6 +69,7 @@ public void testInfo(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("info.title", equalTo("AirlinesRatingApp API")); vr.body("info.version", equalTo("1.0")); + vr.body("info.summary", equalTo("An API for an Airline application")); vr.body("info.termsOfService", equalTo("http://airlinesratingapp.com/terms")); vr.body("info.x-info", equalTo("test-info")); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index 7c638c72..dfeb446f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -62,6 +62,7 @@ public void testInfo(String type) { ValidatableResponse vr = callEndpoint(type); vr.body("info.title", equalTo("AirlinesRatingApp API")); vr.body("info.version", equalTo("1.0")); + vr.body("info.summary", equalTo("An API for an Airline application")); vr.body("info.termsOfService", equalTo("http://airlinesratingapp.com/terms")); } From 908a398e4095d200ffc0a4213c807747471f645b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 11 Apr 2024 14:43:03 +0100 Subject: [PATCH 043/121] Schema annotations: update for OpenAPI 3.1 --- .../annotations/media/DependentRequired.java | 41 +++ .../annotations/media/DependentSchema.java | 41 +++ .../annotations/media/PatternProperty.java | 47 ++++ .../openapi/annotations/media/Schema.java | 261 +++++++++++++++--- .../annotations/media/SchemaProperty.java | 234 ++++++++++++++-- .../annotations/media/package-info.java | 2 +- 6 files changed, 564 insertions(+), 62 deletions(-) create mode 100644 api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java create mode 100644 api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java create mode 100644 api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java new file mode 100644 index 00000000..786dcdae --- /dev/null +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.annotations.media; + +/** + * A property name and an associated list of other property names. + *

+ * Used with {@link Schema#dependentRequired()}, if an object has a property named {@link #name()}, it must also have + * properties with the names in {@link #requires()}. + * + * @see Schema#dependentRequired() + */ +public @interface DependentRequired { + + /** + * The property name to look for + * + * @return a property name + */ + String name(); + + /** + * The property names that an object is required to have, if it has a property named {@link #name()} + * + * @return the required property names + */ + String[] requires(); +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java new file mode 100644 index 00000000..4e7b0091 --- /dev/null +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.annotations.media; + +/** + * A property name and an associated schema. + *

+ * Used with {@link Schema#dependentSchemas()}, if an instance has a property named {@link #name()}, then it must + * validate against {@link #schema()}. + * + * @see Schema#dependentSchemas() + */ +public @interface DependentSchema { + + /** + * A property name + * + * @return property name + */ + String name(); + + /** + * The schema that an instance must validate against if it has a property named {@link #name()}. + * + * @return a class used to generate a schema which is used to validate objects with properties named {@link #name()} + */ + Class schema(); +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java new file mode 100644 index 00000000..e9531a53 --- /dev/null +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.annotations.media; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * A regular expression and an associated schema. + *

+ * Used with {@link Schema#patternProperties()}, properties with names that match {@link #regex()} must have values + * which validate against {@link #schema()}. + * + * @see Schema#patternProperties() + */ +@Target({}) +@Retention(RetentionPolicy.RUNTIME) +public @interface PatternProperty { + + /** + * A regular expression to match against property names. + * + * @return an ECMA-262 regular expression + */ + String regex(); + + /** + * A schema that a property value must validate against + * + * @return a class used to generate a schema used to validate properties with names that match {@link #regex()} + */ + Class schema(); +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java index d5533585..911af50b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java @@ -29,7 +29,21 @@ /** * The Schema Object allows the definition of input and output data types. These types can be objects, but also - * primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. + * primitives and arrays. This object is an extended subset of the JSON Schema draft specification 2020-12. + * + *

Defining subschemas

+ *

+ * Some of the parameters on this annotation correspond to parts of an OpenAPI document where a subschema is expected, + * for example {@link #allOf()}, {@link #contains()} and {@link #propertyNames()}. Due to limitations in the Java + * language, we can't use a second {@code @Schema} annotation, so instead we allow a class to be provided. A schema will + * be generated from that class by introspecting its annotations, methods and fields. + *

+ * In addition, several special values can be used: + *

    + *
  • {@link True} to indicate a boolean {@code true} schema (accepts anything) + *
  • {@link False} to indicate a boolean {@code false} schema (accepts nothing) + *
  • {@link Void} to indicate that the schema should not be included at all (this is the default for most parameters) + *
* * @see OpenAPI * Specification Schema Object @@ -40,10 +54,7 @@ public @interface Schema { /** - * Marker class for use in {@link #additionalProperties() additionalProperties} to indicate that the corresponding - * schema's {@link org.eclipse.microprofile.openapi.models.media.Schema#setAdditionalPropertiesBoolean(Boolean) - * additionalPropertiesBoolean} value is to be set to boolean {@code true}. The value {@code true} declares that any - * properties in addition to those defined by the {@code properties} attribute of the same schema are valid. + * Marker class to indicate that a boolean {@code true} schema should be used. * * @since 3.1 */ @@ -53,10 +64,7 @@ private True() { } /** - * Marker class for use in {@link #additionalProperties() additionalProperties} to indicate that the corresponding - * schema's {@link org.eclipse.microprofile.openapi.models.media.Schema#setAdditionalPropertiesBoolean(Boolean) - * additionalPropertiesBoolean} value is to be set to boolean {@code false}. The value {@code false} declares that - * no property in addition to those defined by the {@code properties} attribute of the same schema is valid. + * Marker class to indicate that a boolean {@code false} schema should be used. * * @since 3.1 */ @@ -84,9 +92,6 @@ private False() { /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If * more than one match the derived schemas, a validation error will occur. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of possible classes for a single match **/ @@ -95,9 +100,6 @@ private False() { /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If any * match, the schema will be considered valid. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of possible class matches **/ @@ -106,9 +108,6 @@ private False() { /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If all * match, the schema will be considered valid. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of classes to match **/ @@ -134,8 +133,8 @@ private False() { String title() default ""; /** - * Constrains a value such that when divided by the multipleOf, the remainder must be an integer. Ignored if the - * value is 0. + * Constrains a value such that when divided by the multipleOf, the result must be an integer. Ignored if the value + * is {@code 0}. * * @return the multiplier constraint of the schema **/ @@ -186,9 +185,11 @@ private False() { int minLength() default 0; /** - * A pattern that the value must satisfy. Ignored if the value is an empty string. + * A regular expression that the value must satisfy. Ignored if the value is an empty string. + *

+ * If the instance is a string, the regular expression must match the instance. * - * @return the pattern of this schema + * @return the ECMA-262 regular expression to match against **/ String pattern() default ""; @@ -214,7 +215,7 @@ private False() { String[] requiredProperties() default {}; /** - * Mandates whether the annotated item is required or not. + * Specifies whether the annotated item is required or not. * * @return whether or not this schema is required **/ @@ -242,8 +243,10 @@ private False() { /** * Reference value to a Schema definition. *

- * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. + *

+ * Unlike {@code ref} on most MP OpenAPI annotations, this property is not mutually exclusive with other + * properties. * * @return a reference to a schema definition **/ @@ -257,8 +260,8 @@ private False() { boolean nullable() default false; /** - * Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY - * be sent as part of a response but SHOULD NOT be sent as part of the request. + * Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent + * as part of the request. *

* If the property is marked as readOnly being true and is in the required list, the required will take effect on * the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. @@ -269,8 +272,8 @@ private False() { boolean readOnly() default false; /** - * Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be - * sent as part of a request but SHOULD NOT be sent as part of the response. + * Declares the property as "write only". This means that it MAY be sent as part of a request but SHOULD NOT be sent + * as part of the response. *

* If the property is marked as writeOnly being true and is in the required list, the required will take effect on * the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. @@ -282,17 +285,26 @@ private False() { /** * A free-form property to include an example of an instance for this schema. - *

- * To represent examples that cannot be naturally represented in JSON or YAML, a string value is used to contain the - * example with escaping where necessary. - *

- * When associated with a specific media type, the example string shall be parsed by the consumer to be treated as - * an object or an array. * * @return an example of this schema + * @deprecated use {@link #examples()} **/ + @Deprecated(since = "4.0") String example() default ""; + /** + * A free-form property to include examples of an instance for this schema. + *

+ * Each example SHOULD validate against this schema. + *

+ * If the schema {@link #type()} is STRING, the value will be interpreted as a literal string, otherwise it will be + * parsed as JSON. + * + * @return an array of examples of this schema + * @since 4.0 + **/ + String[] examples() default {}; + /** * Additional external documentation for this schema. * @@ -463,4 +475,183 @@ private False() { * @since 3.1 */ Extension[] extensions() default {}; + + /** + * A comment to be included in the schema + *

+ * This value is set in the {@code $comment} property of the schema object + * + * @return the comment + * @since 4.0 + */ + String comment() default ""; + + /** + * Requires that the instance must be a specific value. No other values are permitted. + *

+ * The value is parsed as JSON if the schema type is anything other than STRING. + * + * @return the value which the instance must be equal to, expressed according to the type of the schema + * @since 4.0 + */ + String constValue() default ""; + + /** + * A class used to create a schema used to control conditional evaluation. If an instance validates against the + * {@code if} schema then it must also validate against the {@code then} schema. Otherwise it must validate against + * the {@code else} schema. + * + * @return a class used to create the {@code if} schema + * @see #thenSchema() + * @see #elseSchema() + * @since 4.0 + */ + Class ifSchema() default Void.class; + + /** + * A class used to create a schema that an instance must validate against if it validates against the {@code if} + * schema. + * + * @return a class used to create the {@code then} schema + * @see #ifSchema() + * @see #elseSchema() + * @since 4.0 + */ + Class thenSchema() default Void.class; + + /** + * A class used to create a schema that an instance must validate against if it does not validate against the + * {@code if} schema. + * + * @return a class used to create the {@code else} schema + * @see #ifSchema() + * @see #thenSchema() + * @since 4.0 + */ + Class elseSchema() default Void.class; + + /** + * Schemas which an instance must validate against if the instance has certain properties. + *

+ * For each {@link DependentSchema} listed, if the instance is an object which has a property named + * {@link DependentSchema#name() name()} then the instance must validate against the schema created from + * {@link DependentSchema#schema() schema()}. + * + * @return an array of DependentSchema entries + * @since 4.0 + */ + DependentSchema[] dependentSchemas() default {}; + + /** + * A schema which at least one element of an array instance must validate against. + *

+ * The class is used to create a schema. If the instance is an array, then at least one element of the array must + * validate against the schema. + * + * @return a class used to create a schema which at least one element of an array instance must validate against + * @since 4.0 + */ + Class contains() default Void.class; + + /** + * Specifies the maximum number of elements which may validate against the {@link #contains()} schema. + *

+ * If more than this number of elements of an array instance match the {@code contains} schema, the instance does + * not validate against this schema. + * + * @return the maximum number of elements which may validate against the {@link #contains()} schema + * @since 4.0 + */ + int maxContains() default Integer.MAX_VALUE; + + /** + * Specifies the minimum number of elements which must validate against the {@link #contains()} schema. + *

+ * If fewer than this number of elements of an array instance match the {@code contains} schema, the instance does + * not validate against this schema. + * + * @return the minimum number of elements which must validate against the {@link #contains()} schema + * @since 4.0 + */ + int minContains() default 0; + + /** + * Schemas which the leading elements of an array instance must validate against. + *

+ * The array of classes is used to create an array of schemas. If an instance is an array, the first element of the + * array must validate against the first schema, the second element must validate against the second schema and so + * on. + * + * @return an array of classes used to create an array of schemas used to validate the leading elements of an array + * instance + * @since 4.0 + */ + Class[] prefixItems() default {}; + + /** + * Applies subschemas against properties matched by regular expressions. + *

+ * For each {@link PatternProperty} listed, for each property whose name matches {@link PatternProperty#regex() | + * regex()}, its value must validate against the schema created from {@link PatternProperty#schema() schema()}. + * + * @return a mapping from regular expressions to schemas + * @since 4.0 + */ + PatternProperty[] patternProperties() default {}; + + /** + * Specifies that certain properties must be present if other properties are present. + *

+ * For each {@link DependentRequired} entry in the list, if the instance is an object and has a property named + * {@link DependentRequired#name()} then it must also have property named for each entry of + * {@link DependentRequired#requires()} to validate against this schema. + * + * @return the properties required if certain other properties are present + * @since 4.0 + */ + DependentRequired[] dependentRequired() default {}; + + /** + * A schema which the names of properties of an object instance must validate against. + *

+ * The class is used to create a schema. If the instance is an object, then the name of each property in the + * instance must validate against the schema. + * + * @return a schema that property names must validate against + * @since 4.0 + */ + Class propertyNames() default Void.class; + + /** + * The encoding used to allow binary data to be stored in a string. + *

+ * If the instance is a string, this property specifies that it contains binary data encoded as text using the + * specified encoding (e.g. base64). + * + * @return the encoding + * @since 4.0 + */ + String contentEncoding() default ""; + + /** + * The media type of the data in a string. + *

+ * If the instance is a string, this property specifies the media type of the data it contains. If + * {@link #contentEncoding()} is also set, it specifies the media type of the decoded string. + * + * @return the media type of the data in a string + * @since 4.0 + */ + String contentMediaType() default ""; + + /** + * The schema that data in a string must validate against. + *

+ * The class is used to create a schema. If the instance is a string and {@link #contentMediaType()} is set, the + * data must validate against the schema when interpreted as the given media type. + * + * @return a class used to create a schema used to validate the data in a string + * @since 4.0 + */ + Class contentSchema() default Void.class; } diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java index e603b2bc..87429909 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java @@ -29,7 +29,7 @@ * properties attribute of a {@link Schema} annotation. These types can be objects, but also primitives and * arrays. * - * This object is an extended subset of the JSON Schema Specification Wright Draft 00. + * This object is an extended subset of the JSON Schema draft specification 2020-12. * * @see OpenAPI * Specification Schema Object @@ -58,9 +58,6 @@ /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If * more than one match the derived schemas, a validation error will occur. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of possible classes for a single match **/ @@ -69,9 +66,6 @@ /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If any * match, the schema will be considered valid. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of possible class matches **/ @@ -80,9 +74,6 @@ /** * Provides an array of java class implementations which can be used to describe multiple acceptable schemas. If all * match, the schema will be considered valid. - *

- * Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. - *

* * @return the list of classes to match **/ @@ -106,8 +97,8 @@ String title() default ""; /** - * Constrains a value such that when divided by the multipleOf, the remainder must be an integer. Ignored if the - * value is 0. + * Constrains a value such that when divided by the multipleOf, the result must be an integer. Ignored if the value + * is {@code 0}. * * @return the multiplier constraint of the schema **/ @@ -158,9 +149,11 @@ int minLength() default 0; /** - * A pattern that the value must satisfy. Ignored if the value is an empty string. + * A regular expression that the value must satisfy. Ignored if the value is an empty string. + *

+ * If the instance is a string, the regular expression must match the instance. * - * @return the pattern of this schema + * @return the ECMA-262 regular expression to match against **/ String pattern() default ""; @@ -207,8 +200,10 @@ /** * Reference value to a Schema definition. *

- * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. + *

+ * Unlike {@code ref} on most MP OpenAPI annotations, this property is not mutually exclusive with other + * properties. * * @return a reference to a schema definition **/ @@ -222,8 +217,8 @@ boolean nullable() default false; /** - * Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY - * be sent as part of a response but SHOULD NOT be sent as part of the request. + * Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent + * as part of the request. *

* If the property is marked as readOnly being true and is in the required list, the required will take effect on * the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. @@ -234,8 +229,8 @@ boolean readOnly() default false; /** - * Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be - * sent as part of a request but SHOULD NOT be sent as part of the response. + * Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as + * part of the response. *

* If the property is marked as writeOnly being true and is in the required list, the required will take effect on * the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. @@ -247,17 +242,26 @@ /** * A free-form property to include an example of an instance for this schema. - *

- * To represent examples that cannot be naturally represented in JSON or YAML, a string value is used to contain the - * example with escaping where necessary. - *

- * When associated with a specific media type, the example string shall be parsed by the consumer to be treated as - * an object or an array. * * @return an example of this schema + * @deprecated use {@link #examples()} **/ + @Deprecated(since = "4.0") String example() default ""; + /** + * A free-form property to include examples of an instance for this schema. + *

+ * Each example SHOULD validate against this schema. + *

+ * If the schema {@link #type()} is STRING, the value will be interpreted as a literal string, otherwise it will be + * parsed as JSON. + * + * @return an array of examples of this schema + * @since 4.0 + **/ + String[] examples() default {}; + /** * Additional external documentation for this schema. * @@ -374,4 +378,182 @@ */ Extension[] extensions() default {}; + /** + * A comment to be included in the schema + *

+ * This value is set in the {@code $comment} property of the schema object + * + * @return the comment + * @since 4.0 + */ + String comment() default ""; + + /** + * Requires that the instance must be a specific value. No other values are permitted. + *

+ * The value is parsed as JSON if the schema type is anything other than STRING. + * + * @return the value which the instance must be equal to, expressed according to the type of the schema + * @since 4.0 + */ + String constValue() default ""; + + /** + * A class used to create a schema used to control conditional evaluation. If an instance validates against the + * {@code if} schema then it must also validate against the {@code then} schema. Otherwise it must validate against + * the {@code else} schema. + * + * @return a class used to create the {@code if} schema + * @see #thenSchema() + * @see #elseSchema() + * @since 4.0 + */ + Class ifSchema() default Void.class; + + /** + * A class used to create a schema that an instance must validate against if it validates against the {@code if} + * schema. + * + * @return a class used to create the {@code then} schema + * @see #ifSchema() + * @see #elseSchema() + * @since 4.0 + */ + Class thenSchema() default Void.class; + + /** + * A class used to create a schema that an instance must validate against if it does not validate against the + * {@code if} schema. + * + * @return a class used to create the {@code else} schema + * @see #ifSchema() + * @see #thenSchema() + * @since 4.0 + */ + Class elseSchema() default Void.class; + + /** + * Schemas which an instance must validate against if the instance has certain properties. + *

+ * For each {@link DependentSchema} listed, if the instance is an object which has a property named + * {@link DependentSchema#name() name()} then the instance must validate against the schema created from + * {@link DependentSchema#schema() schema()}. + * + * @return an array of DependentSchema entries + * @since 4.0 + */ + DependentSchema[] dependentSchemas() default {}; + + /** + * A schema which at least one element of an array instance must validate against. + *

+ * The class is used to create a schema. If the instance is an array, then at least one element of the array must + * validate against the schema. + * + * @return a class used to create a schema which at least one element of an array instance must validate against + * @since 4.0 + */ + Class contains() default Void.class; + + /** + * Specifies the maximum number of elements which may validate against the {@link #contains()} schema. + *

+ * If more than this number of elements of an array instance match the {@code contains} schema, the instance does + * not validate against this schema. + * + * @return the maximum number of elements which may validate against the {@link #contains()} schema + * @since 4.0 + */ + int maxContains() default Integer.MAX_VALUE; + + /** + * Specifies the minimum number of elements which must validate against the {@link #contains()} schema. + *

+ * If fewer than this number of elements of an array instance match the {@code contains} schema, the instance does + * not validate against this schema. + * + * @return the minimum number of elements which must validate against the {@link #contains()} schema + * @since 4.0 + */ + int minContains() default 0; + + /** + * Schemas which the leading elements of an array instance must validate against. + *

+ * The array of classes is used to create an array of schemas. If an instance is an array, the first element of the + * array must validate against the first schema, the second element must validate against the second schema and so + * on. + * + * @return an array of classes used to create an array of schemas used to validate the leading elements of an array + * instance + * @since 4.0 + */ + Class[] prefixItems() default {}; + + /** + * Applies subschemas against properties matched by regular expressions. + *

+ * For each {@link PatternProperty} listed, for each property whose name matches {@link PatternProperty#regex() | + * regex()}, its value must validate against the schema created from {@link PatternProperty#schema() schema()}. + * + * @return a mapping from regular expressions to schemas + * @since 4.0 + */ + PatternProperty[] patternProperties() default {}; + + /** + * Specifies that certain properties must be present if other properties are present. + *

+ * For each {@link DependentRequired} entry in the list, if the instance is an object and has a property named + * {@link DependentRequired#name()} then it must also have property named for each entry of + * {@link DependentRequired#requires()} to validate against this schema. + * + * @return the properties required if certain other properties are present + * @since 4.0 + */ + DependentRequired[] dependentRequired() default {}; + + /** + * A schema which the names of properties of an object instance must validate against. + *

+ * The class is used to create a schema. If the instance is an object, then the name of each property in the + * instance must validate against the schema. + * + * @return a schema that property names must validate against + * @since 4.0 + */ + Class propertyNames() default Void.class; + + /** + * The encoding used to allow binary data to be stored in a string. + *

+ * If the instance is a string, this property specifies that it contains binary data encoded as text using the + * specified encoding (e.g. base64). + * + * @return the encoding + * @since 4.0 + */ + String contentEncoding() default ""; + + /** + * The media type of the data in a string. + *

+ * If the instance is a string, this property specifies the media type of the data it contains. If + * {@link #contentEncoding()} is also set, it specifies the media type of the decoded string. + * + * @return the media type of the data in a string + * @since 4.0 + */ + String contentMediaType() default ""; + + /** + * The schema that data in a string must validate against. + *

+ * The class is used to create a schema. If the instance is a string and {@link #contentMediaType()} is set, the + * data must validate against the schema when interpreted as the given media type. + * + * @return a class used to create a schema used to validate the data in a string + * @since 4.0 + */ + Class contentSchema() default Void.class; } diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/package-info.java index a0fb0c55..1c8176ad 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/package-info.java @@ -25,6 +25,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.2") +@org.osgi.annotation.versioning.Version("1.3") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.annotations.media; \ No newline at end of file From 5660eba0443105db323f6f2b8bbf5af23e13f215 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 12 Apr 2024 16:31:26 +0100 Subject: [PATCH 044/121] Schema annotation new field TCKs Test new parameters on the Schema annotation which don't involve subschemas. - comment - const - dependentRequired - contentEncoding - contentMediaType --- .../openapi/apps/airlines/JAXRSApp.java | 3 +- .../openapi/apps/airlines/model/User.java | 78 ++++++++++++++++++- .../openapi/tck/AirlinesAppTest.java | 16 +++- 3 files changed, 92 insertions(+), 5 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index a9995962..37c1404f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -115,7 +115,8 @@ type = SchemaType.ARRAY, implementation = Airline.class, extensions = @Extension(name = "x-schema", - value = "test-schema")), + value = "test-schema"), + comment = "This is an airline"), @Schema(name = "id", type = SchemaType.INTEGER, format = "int32"), @Schema(name = "AirlinesRef", ref = "#/components/schemas/Airlines"), diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/User.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/User.java index 5e428e2d..868e80fd 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/User.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/model/User.java @@ -13,9 +13,19 @@ package org.eclipse.microprofile.openapi.apps.airlines.model; -import org.eclipse.microprofile.openapi.annotations.media.Schema; +import java.time.LocalDate; -@Schema(maxProperties = 1024, minProperties = 1, requiredProperties = {"id", "username", "password"}) +import org.eclipse.microprofile.openapi.annotations.media.DependentRequired; +import org.eclipse.microprofile.openapi.annotations.media.DependentSchema; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.eclipse.microprofile.openapi.annotations.media.Schema.False; +import org.eclipse.microprofile.openapi.annotations.media.Schema.True; + +@Schema(maxProperties = 1024, minProperties = 1, + requiredProperties = {"id", "username", "password"}, + dependentRequired = @DependentRequired(name = "frequentFlyerNumber", + requires = {"frequentFlyerProgrammeName", "frequentFlyerStartDate"}), + dependentSchemas = @DependentSchema(name = "forbiddenField", schema = False.class)) public class User { @Schema(example = "3456") @@ -51,6 +61,22 @@ public class User { @Schema(hidden = true) private String undocumentedProperty; + private String frequentFlyerNumber; + + private String frequentFlyerProgrammeName; + + private LocalDate frequentFlyerStartDate; + + @Schema(constValue = "true") + private boolean human; + + /** Base64 encoded JPEG photo */ + @Schema(contentEncoding = "base64", contentMediaType = "image/jpeg") + private String photo; + + @Schema(implementation = True.class) + private Object freeformNotes; + /** * Creates a User instance with the parameters specified. * @@ -290,4 +316,52 @@ public void setUndocumentedProperty(String undocumentedProperty) { this.undocumentedProperty = undocumentedProperty; } + public String getFrequentFlyerNumber() { + return frequentFlyerNumber; + } + + public void setFrequentFlyerNumber(String frequentFlyerNumber) { + this.frequentFlyerNumber = frequentFlyerNumber; + } + + public String getFrequentFlyerProgrammeName() { + return frequentFlyerProgrammeName; + } + + public void setFrequentFlyerProgrammeName(String frequentFlyerProgrammeName) { + this.frequentFlyerProgrammeName = frequentFlyerProgrammeName; + } + + public LocalDate getFrequentFlyerStartDate() { + return frequentFlyerStartDate; + } + + public void setFrequentFlyerStartDate(LocalDate frequentFlyerStartDate) { + this.frequentFlyerStartDate = frequentFlyerStartDate; + } + + public String getPhoto() { + return photo; + } + + public void setPhoto(String photo) { + this.photo = photo; + } + + public boolean getHuman() { + return human; + } + + public void setHuman(boolean human) { + this.human = human; + } + + public Object getFreeformNotes() { + return freeformNotes; + } + + public void setFreeformNotes(Object freeformNotes) { + this.freeformNotes = freeformNotes; + } + } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 96b54ecb..29ebb5fa 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -700,6 +700,7 @@ public void testSchema(String type) { // Basic properties vr.body("components.schemas.AirlinesRef.$ref", equalTo("#/components/schemas/Airlines")); vr.body("components.schemas.Airlines.title", equalTo("Airlines")); + vr.body("components.schemas.Airlines.$comment", equalTo("This is an airline")); vr.body("components.schemas.Airlines.x-schema", equalTo("test-schema")); vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", itemOrSingleton("string")); @@ -714,6 +715,17 @@ public void testSchema(String type) { vr.body("components.schemas.User.required", hasItems("id", "username", "password")); // requiredProperties vr.body("components.schemas.User", not(hasItem("undocumentedProperty"))); // hidden property vr.body("components.schemas.Gender.enum", hasItems("Male", "Female", "Other")); + vr.body("components.schemas.User.dependentRequired", aMapWithSize(1)); + vr.body("components.schemas.User.dependentRequired.frequentFlyerNumber", + contains("frequentFlyerProgrammeName", "frequentFlyerStartDate")); + String photoPath = dereference(vr, "components.schemas.User.properties.photo"); + vr.body(photoPath + ".contentEncoding", equalTo("base64")); + vr.body(photoPath + ".contentMediaType", equalTo("image/jpeg")); + String humanPath = dereference(vr, "components.schemas.User.properties.human"); + vr.body(humanPath + ".const", equalTo(true)); + vr.body("components.schemas.User.properties.freeformNotes", equalTo(true)); + vr.body("components.schemas.User.dependentSchemas", aMapWithSize(1)); + vr.body("components.schemas.User.dependentSchemas.forbiddenField", equalTo(false)); // Array properties String createSchema = "paths.'/user/createWithArray'.post.requestBody.content.'application/json'.schema"; @@ -727,7 +739,7 @@ public void testSchema(String type) { @Test(dataProvider = "formatProvider") public void testSchemaProperty(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(10)); + vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(16)); vr.body("components.schemas.User.properties.phone.examples", contains("123-456-7891")); vr.body("components.schemas.User.properties.phone.description", equalTo("Telephone number to contact the user")); @@ -737,7 +749,7 @@ public void testSchemaProperty(String type) { @Test(dataProvider = "formatProvider") public void testSchemaPropertyValuesOverrideClassPropertyValues(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(10)); + vr.body("components.schemas.User.properties", IsMapWithSize.aMapWithSize(16)); vr.body("components.schemas.User.properties.phone.examples", not(contains("123-456-7890"))); vr.body("components.schemas.User.properties.phone.examples", contains("123-456-7891")); } From cd35c078ba1b52c4e051bd763de0825822413218 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 16 Apr 2024 16:17:12 +0100 Subject: [PATCH 045/121] Add additionalProperties to SchemaProperty --- .../annotations/media/SchemaProperty.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java index 87429909..9a915dd6 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java @@ -23,6 +23,8 @@ import org.eclipse.microprofile.openapi.annotations.ExternalDocumentation; import org.eclipse.microprofile.openapi.annotations.enums.SchemaType; import org.eclipse.microprofile.openapi.annotations.extensions.Extension; +import org.eclipse.microprofile.openapi.annotations.media.Schema.False; +import org.eclipse.microprofile.openapi.annotations.media.Schema.True; /** * The SchemaProperty Object allows the definition of input and output data types nested within the @@ -368,6 +370,32 @@ **/ boolean uniqueItems() default false; + /** + * Provides a Java class as implementation for additional properties that may be present in instances of this + * schema. + * + *

+ * If no additional properties are allowed, the value of this property should be set to {@link False False.class} + * which will be rendered as boolean false in the resulting OpenAPI document. + * + *

+ * The default value {@link Void Void.class} will result in no {@code additionalProperties} attribute being + * generated in the resulting OpenAPI document. The effective value in that case is {@code true} per the OpenAPI + * specification. + * + *

+ * Implementations MAY ignore this property if this schema's {@linkplain #type() type} is not + * {@linkplain SchemaType#OBJECT OBJECT}, either explicitly or as derived by the placement of the annotation. + * + * @return a class that describes the allowable schema for additional properties not explicitly defined + * + * @since 4.0 + * + * @see True + * @see False + */ + Class additionalProperties() default Void.class; + /** * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.media.Schema Schema} model * corresponding to the containing annotation. From 4b4513bf849778611d9353513fa168a763cee289 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Sun, 28 Apr 2024 14:21:15 +0100 Subject: [PATCH 046/121] expect openapi version 3.1.x --- .../org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 2 +- .../eclipse/microprofile/openapi/tck/ModelReaderAppTest.java | 2 +- .../microprofile/openapi/tck/OASConfigScanClassBase.java | 2 +- .../microprofile/openapi/tck/OASConfigScanDisableTest.java | 2 +- .../org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java | 2 +- .../eclipse/microprofile/openapi/tck/StaticDocumentTest.java | 2 +- tck/src/main/resources/openapi.yaml | 4 ++-- tck/src/main/resources/simpleapi.yaml | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 29ebb5fa..83abd069 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -61,7 +61,7 @@ public static WebArchive createDeployment() { @Test(dataProvider = "formatProvider") public void testVersion(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("openapi", startsWith("3.0.")); + vr.body("openapi", startsWith("3.1.")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index 1dc34a99..49d5ecc7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -55,7 +55,7 @@ public static WebArchive createDeployment() { @Test(dataProvider = "formatProvider") public void testVersion(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("openapi", startsWith("3.0.")); + vr.body("openapi", startsWith("3.1.")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanClassBase.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanClassBase.java index ed55e11d..dea0af4a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanClassBase.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanClassBase.java @@ -33,7 +33,7 @@ public abstract class OASConfigScanClassBase extends AppTestBase { @Test(dataProvider = "formatProvider") public void testScanClass(String type) throws InterruptedException { vr = callEndpoint(type); - vr.body("openapi", startsWith("3.0.")); + vr.body("openapi", startsWith("3.1.")); vr.body("paths", aMapWithSize(5)); vr.body("paths", hasKey("/reviews")); vr.body("paths", hasKey("/reviews/{id}")); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanDisableTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanDisableTest.java index ba35e4ed..4a4c83c1 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanDisableTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASConfigScanDisableTest.java @@ -40,7 +40,7 @@ public static WebArchive createDeployment() { @Test(dataProvider = "formatProvider") public void testScanDisable(String type) throws InterruptedException { vr = callEndpoint(type); - vr.body("openapi", startsWith("3.0.")); + vr.body("openapi", startsWith("3.1.")); vr.body("info", notNullValue()); vr.body("info.title", notNullValue()); vr.body("info.version", notNullValue()); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 024856f1..2bcfd711 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -194,7 +194,7 @@ public void testDefaultResponseType() { .assertThat() .statusCode(200) .and() - .body("openapi", startsWith("3.0.")); + .body("openapi", startsWith("3.1.")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java index b99ec31c..fd13c201 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java @@ -47,7 +47,7 @@ public static WebArchive createDeployment() { public void testStaticDocument(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("openapi", startsWith("3.0.")); + vr.body("openapi", startsWith("3.1.")); vr.body("servers", hasSize(1)); vr.body("servers.find{ it.description == 'MySimpleAPI' }.url", diff --git a/tck/src/main/resources/openapi.yaml b/tck/src/main/resources/openapi.yaml index 94016fcf..6f0a7657 100644 --- a/tck/src/main/resources/openapi.yaml +++ b/tck/src/main/resources/openapi.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -openapi: 3.0.2 +openapi: 3.1.0 info: title: Callback Example version: 1.0.0 @@ -73,4 +73,4 @@ paths: '204': description: | Your server should return this HTTP status code if no longer interested - in further updates \ No newline at end of file + in further updates diff --git a/tck/src/main/resources/simpleapi.yaml b/tck/src/main/resources/simpleapi.yaml index 7e414995..bea1eb26 100644 --- a/tck/src/main/resources/simpleapi.yaml +++ b/tck/src/main/resources/simpleapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.2 +openapi: 3.1.0 servers: - description: MySimpleAPI url: https:///MySimpleAPI/1.0.0 @@ -163,4 +163,4 @@ components: type: string examples: - 408-867-5309 - type: object \ No newline at end of file + type: object From f1c7143d6710a7afc4cb8d08d97636073d7b5e55 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 2 May 2024 15:21:09 +0100 Subject: [PATCH 047/121] fix checkstyle errors --- .../microprofile/openapi/models/PathItem.java | 10 +++++++++- .../apps/airlines/resources/AirlinesResource.java | 3 ++- .../openapi/apps/petstore/resource/PetResource.java | 4 +++- .../openapi/reader/MyOASModelReaderImpl.java | 1 + .../openapi/tck/ModelConstructionTest.java | 12 ++++-------- .../microprofile/openapi/tck/PetStoreAppTest.java | 10 +++++----- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java index e611e438..ecd6c18d 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java @@ -120,6 +120,7 @@ default PathItem description(String description) { * definition of a GET operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem GET(Operation get) { setGET(get); return this; @@ -147,6 +148,7 @@ default PathItem GET(Operation get) { * definition of a PUT operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem PUT(Operation put) { setPUT(put); return this; @@ -174,6 +176,7 @@ default PathItem PUT(Operation put) { * definition of a PUT operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem POST(Operation post) { setPOST(post); return this; @@ -201,6 +204,7 @@ default PathItem POST(Operation post) { * definition of a DELETE operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem DELETE(Operation delete) { setDELETE(delete); return this; @@ -228,6 +232,7 @@ default PathItem DELETE(Operation delete) { * definition of an OPTIONS operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem OPTIONS(Operation options) { setOPTIONS(options); return this; @@ -255,6 +260,7 @@ default PathItem OPTIONS(Operation options) { * definition of a HEAD operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem HEAD(Operation head) { setHEAD(head); return this; @@ -282,6 +288,7 @@ default PathItem HEAD(Operation head) { * definition of a PATCH operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem PATCH(Operation patch) { setPATCH(patch); return this; @@ -309,6 +316,7 @@ default PathItem PATCH(Operation patch) { * definition of a TRACE operation * @return the current PathItem instance **/ + @SuppressWarnings("checkstyle:methodname") default PathItem TRACE(Operation trace) { setTRACE(trace); return this; @@ -420,4 +428,4 @@ default PathItem parameters(List parameters) { **/ void removeParameter(Parameter parameter); -} \ No newline at end of file +} diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/AirlinesResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/AirlinesResource.java index 6e81186b..cc70f5de 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/AirlinesResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/AirlinesResource.java @@ -70,7 +70,8 @@ public static Airline getRandomAirline() { @Extension(name = "x-boolean-property", value = "true", parseValue = true), @Extension(name = "x-number-property", value = "117", parseValue = true), @Extension(name = "x-object-property", - value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\", \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }", + value = "{ \"property-1\" : \"value-1\", \"property-2\" : \"value-2\"," + + " \"property-3\" : { \"prop-3-1\" : 17, \"prop-3-2\" : true } }", parseValue = true), @Extension(name = "x-string-array-property", value = "[ \"one\", \"two\", \"three\" ]", parseValue = true), @Extension(name = "x-object-array-property", diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java index 322b755a..0efb5c7e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java @@ -168,6 +168,7 @@ public Response deletePet( @APIResponse(responseCode = "400", description = "Invalid input", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ApiResponse.class))) + @SuppressWarnings("checkstyle:linelength") @RequestBody(name = "pet", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class), examples = @ExampleObject(ref = "http://example.org/petapi-examples/openapi.json#/components/examples/pet-example")), @@ -203,7 +204,8 @@ public Response updatePet( @Produces("application/json") @Callback(name = "tagsCallback", callbackUrlExpression = "http://petstoreapp.com/pet", operations = @CallbackOperation(method = "GET", summary = "Finds Pets by tags", - description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", + description = "Find Pets by tags; Muliple tags can be provided with comma seperated strings. " + + "Use tag1, tag2, tag3 for testing.", responses = { @APIResponse(responseCode = "400", description = "Invalid tag value", diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 45ce98a3..8c7048f6 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -57,6 +57,7 @@ public class MyOASModelReaderImpl implements OASModelReader { @Override + @SuppressWarnings("checkstyle:methodlength") public OpenAPI buildModel() { return OASFactory.createObject(OpenAPI.class) .info(OASFactory.createObject(Info.class) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index dd736060..f4e3adcc 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -1922,10 +1922,8 @@ private Map collectProperties(Class clazz) { p.addBuilder(m); } } - } - // Possible setter method - else if (returnType == Void.TYPE) { - if (name.startsWith("set") && parameterCount == 1) { + } else if (returnType == Void.TYPE) { + if (name.startsWith("set") && parameterCount == 1) { // Possible setter method name = Introspector.decapitalize(name.substring(3)); type = m.getParameterTypes()[0]; p = properties.get(name); @@ -1937,10 +1935,8 @@ else if (returnType == Void.TYPE) { p.addSetter(m); } } - } - // Possible getter method - else { - if (name.startsWith("get") && parameterCount == 0) { + } else { + if (name.startsWith("get") && parameterCount == 0) { // Possible getter method name = Introspector.decapitalize(name.substring(3)); type = returnType; p = properties.get(name); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 024856f1..e1504408 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -278,16 +278,16 @@ public void testAPIResponseSchemaDefaultResponseCode(String type) { public void testExtensionPlacement(String type) { ValidatableResponse vr = callEndpoint(type); - final String X_OPERATION_EXT = "x-operation-ext"; - final String TEST_OPERATION_EXT = "test-operation-ext"; + final String xOperationExt = "x-operation-ext"; + final String testOperationExt = "test-operation-ext"; String opPath = "paths.'/store/inventory'.get"; - vr.body(opPath, hasEntry(equalTo(X_OPERATION_EXT), equalTo(TEST_OPERATION_EXT))); + vr.body(opPath, hasEntry(equalTo(xOperationExt), equalTo(testOperationExt))); vr.body(opPath + ".responses", hasEntry(equalTo("x-responses-ext"), equalTo("test-responses-ext"))); - vr.body(opPath + ".responses.'200'", not(hasKey(X_OPERATION_EXT))); + vr.body(opPath + ".responses.'200'", not(hasKey(xOperationExt))); vr.body(opPath + ".responses.'200'", hasEntry(equalTo("x-response-ext"), equalTo("test-response-ext"))); - vr.body(opPath + ".responses.'500'", not(hasKey(X_OPERATION_EXT))); + vr.body(opPath + ".responses.'500'", not(hasKey(xOperationExt))); vr.body(opPath + ".responses.'503'.content.'application/json'", hasEntry(equalTo("x-notavailable-ext"), equalTo("true"))); vr.body(opPath + ".responses.'503'.content.'application/xml'", From e620f397c83f4bc8bad52588979f0019187ebac2 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 2 May 2024 15:26:17 +0100 Subject: [PATCH 048/121] checkstyle fixes with actual code change --- .../microprofile/openapi/apps/airlines/data/UserData.java | 2 +- .../microprofile/openapi/apps/petstore/data/PetData.java | 4 ++-- .../microprofile/openapi/apps/petstore/data/StoreData.java | 2 +- .../microprofile/openapi/apps/petstore/data/UserData.java | 2 +- .../openapi/apps/petstore/model/ApiResponse.java | 6 +++--- .../microprofile/openapi/apps/petstore/model/Cat.java | 2 +- .../microprofile/openapi/apps/petstore/model/Dog.java | 2 +- .../microprofile/openapi/apps/petstore/model/Lizard.java | 2 +- .../openapi/apps/petstore/resource/PetResource.java | 2 +- .../openapi/apps/petstore/resource/PetStoreResource.java | 4 ++-- .../openapi/apps/petstore/resource/UserResource.java | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/data/UserData.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/data/UserData.java index b53815f0..3b76c1ef 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/data/UserData.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/data/UserData.java @@ -19,7 +19,7 @@ import org.eclipse.microprofile.openapi.apps.airlines.model.User; public class UserData { - static List users = new ArrayList(); + static private List users = new ArrayList(); static { users.add(createUser(1, "Bob1", "pswd", "Bob", "Smith", "male", 12, diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java index a119e96e..e72dbdc7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java @@ -23,8 +23,8 @@ import org.eclipse.microprofile.openapi.apps.petstore.model.Tag; public class PetData { - static List pets = new ArrayList(); - static List categories = new ArrayList(); + static private List pets = new ArrayList(); + static private List categories = new ArrayList(); static { categories.add(createCategory(1, "Dogs")); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/StoreData.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/StoreData.java index 7161f25b..31f334bb 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/StoreData.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/StoreData.java @@ -20,7 +20,7 @@ import org.eclipse.microprofile.openapi.apps.petstore.model.Order; public class StoreData { - static List orders = new ArrayList(); + private static List orders = new ArrayList(); static { orders.add(createOrder(1, 1, 2, new Date(), "placed")); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/UserData.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/UserData.java index e385286a..e7ad2bda 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/UserData.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/UserData.java @@ -19,7 +19,7 @@ import org.eclipse.microprofile.openapi.apps.petstore.model.User; public class UserData { - static List users = new ArrayList(); + private static List users = new ArrayList(); static { users.add(createUser(1, "user1", "first name 1", "last name 1", diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/ApiResponse.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/ApiResponse.java index 7b11127d..f3083406 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/ApiResponse.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/ApiResponse.java @@ -23,9 +23,9 @@ public class ApiResponse { public static final int OK = 4; public static final int TOO_BUSY = 5; - int code; - String type; - String message; + private int code; + private String type; + private String message; public ApiResponse() { } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Cat.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Cat.java index a6a2cdaf..1738b4f4 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Cat.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Cat.java @@ -18,7 +18,7 @@ @XmlRootElement(name = "Cat") public class Cat extends Pet { - String catBreed; + private String catBreed; public String getCatBreed() { return catBreed; diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Dog.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Dog.java index 6a69ff0a..1cba9b2f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Dog.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Dog.java @@ -18,7 +18,7 @@ @XmlRootElement(name = "Dog") public class Dog extends Pet { - String dogBreed; + private String dogBreed; public String getDogBreed() { return dogBreed; diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Lizard.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Lizard.java index cc508ce0..fb23d2c9 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Lizard.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/model/Lizard.java @@ -18,7 +18,7 @@ @XmlRootElement(name = "Lizard") public class Lizard extends Pet { - String lizardBreed; + private String lizardBreed; public String getLizardBreed() { return lizardBreed; diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java index 0efb5c7e..9d74f262 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java @@ -77,7 +77,7 @@ }) public class PetResource { - static PetData petData = new PetData(); + static private PetData petData = new PetData(); @GET @Path("/{petId}") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java index d34971fc..a4a9426c 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java @@ -59,8 +59,8 @@ @Extension(name = "x-mp-type1", value = "true") @Extension(name = "x-mp-type2", value = "false") public class PetStoreResource { - static StoreData storeData = new StoreData(); - static PetData petData = new PetData(); + static private StoreData storeData = new StoreData(); + static private PetData petData = new PetData(); @GET @Path("/inventory") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java index 9018e3c8..be994b3a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java @@ -57,7 +57,7 @@ scheme = "bearer", bearerFormat = "JWT") }) public class UserResource { - static UserData userData = new UserData(); + private static UserData userData = new UserData(); @POST @APIResponse(description = "successful operation") From fbcbb6e8c5cb319c369befc16adfbb995e66f795 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 9 May 2024 11:06:31 +0100 Subject: [PATCH 049/121] update to latest microprofile parent --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7f40622c..5a6e2e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.8 + 2.9-RC1 org.eclipse.microprofile.openapi From 634ced929760fc9ff2f0b3976239913b935cd0f6 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Mon, 13 May 2024 12:28:04 +0100 Subject: [PATCH 050/121] add mutualTLS as a SecuritySchemeType --- .../openapi/annotations/enums/SecuritySchemeType.java | 3 ++- .../microprofile/openapi/annotations/enums/package-info.java | 2 +- .../microprofile/openapi/models/security/SecurityScheme.java | 2 +- .../microprofile/openapi/models/security/package-info.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java index 85728435..325135ac 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java @@ -18,7 +18,8 @@ package org.eclipse.microprofile.openapi.annotations.enums; public enum SecuritySchemeType { - DEFAULT(""), APIKEY("apiKey"), HTTP("http"), OPENIDCONNECT("openIdConnect"), OAUTH2("oauth2"); + DEFAULT(""), APIKEY("apiKey"), HTTP("http"), OPENIDCONNECT("openIdConnect"), OAUTH2("oauth2"), MUTUALTLS( + "mutualTLS"); private String value; diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/package-info.java index fccaecfb..0b72ec8f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/package-info.java @@ -22,6 +22,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.0") +@org.osgi.annotation.versioning.Version("1.1") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.annotations.enums; \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java index e6269ed1..cb4f4028 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java @@ -36,7 +36,7 @@ public interface SecurityScheme extends Constructible, Extensible */ public enum Type { - APIKEY("apiKey"), HTTP("http"), OAUTH2("oauth2"), OPENIDCONNECT("openIdConnect"); + APIKEY("apiKey"), HTTP("http"), OAUTH2("oauth2"), OPENIDCONNECT("openIdConnect"), MUTUALTLS("mutualTLS"); private final String value; diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/package-info.java index d1e6b5a0..b9380d43 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/package-info.java @@ -28,6 +28,6 @@ * */ -@org.osgi.annotation.versioning.Version("2.0") +@org.osgi.annotation.versioning.Version("2.1") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.models.security; \ No newline at end of file From 91905e7a6379ddb15e6c6bfd83ae368ec4290c65 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Mon, 13 May 2024 12:29:31 +0100 Subject: [PATCH 051/121] add test for mutualTLS SecuritySchemeType --- .../airlines/resources/ZepplinResource.java | 42 +++++++++++++++++++ .../openapi/tck/AirlinesAppTest.java | 4 ++ 2 files changed, 46 insertions(+) create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java new file mode 100644 index 00000000..4bf737c7 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations + * under the License. + */ + +package org.eclipse.microprofile.openapi.apps.airlines.resources; + +import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; +import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; +import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme; + +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Response; + +@Path("/zepplins") +@SecurityScheme(securitySchemeName = "mutualTLSScheme", type = SecuritySchemeType.MUTUALTLS, + description = "mutualTLS authentication needed to manage zepplins") +public class ZepplinResource { + + @DELETE + @Path("{id}") + @APIResponse(responseCode = "200", description = "Review deleted") + @APIResponse(responseCode = "404", description = "Review not found") + @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") + @Produces("text/plain") + @SecurityRequirement(name = "mutualTLSScheme") + public Response deprecateZepplin() { + return Response.ok().build(); + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 29ebb5fa..45b14619 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -594,6 +594,10 @@ public void testSecurityScheme(String type) { String reviewoauth2 = "components.securitySchemes.reviewoauth2."; vr.body(reviewoauth2 + "type", equalTo("oauth2")); vr.body(reviewoauth2 + "description", equalTo("authentication needed to create and delete reviews")); + + String mutualTLS = "components.securitySchemes.mutualTLSScheme."; + vr.body(mutualTLS + "type", equalTo("mutualTLS")); + vr.body(mutualTLS + "description", equalTo("mutualTLS authentication needed to manage zepplins")); } @Test(dataProvider = "formatProvider") From 4d7e51d9e0a0df28aa368b48d297389594f6b91e Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Tue, 14 May 2024 09:45:12 +0100 Subject: [PATCH 052/121] document requirement that default server variable must be in the enumeration if it is set --- .../openapi/annotations/servers/ServerVariable.java | 4 +++- .../microprofile/openapi/models/servers/ServerVariable.java | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java index ef157eeb..cc015c71 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java @@ -52,8 +52,10 @@ /** * The default value of this server variable. This is a REQUIRED property. + *

+ * If {@code enumeration} is set the default value MUST be one of the values in {@code enumeration}. * - * @return the defualt value of this server variable + * @return the default value of this server variable **/ String defaultValue(); diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java index d97697d4..e9843bd0 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java @@ -105,6 +105,8 @@ default ServerVariable enumeration(List enumeration) { * The default value to use for substitution, and to send, if an alternate value is not supplied. This value MUST be * provided by the consumer and is REQUIRED. *

+ * If {@code enumeration} is set the default value MUST be one of the values in {@code enumeration}. + *

* This method sets the defaultValue property of ServerVariable instance to the given defaultValue argument. *

* @@ -117,6 +119,8 @@ default ServerVariable enumeration(List enumeration) { * The default value to use for substitution, and to send, if an alternate value is not supplied. This value MUST be * provided by the consumer and is REQUIRED. *

+ * If {@code enumeration} is set the default value MUST be one of the values in {@code enumeration}. + *

* This method sets the defaultValue property of ServerVariable instance to the given defaultValue argument and * returns the modified instance. *

From a0068d1913efc0d0cff17a62e5482c31424db33d Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 2 May 2024 09:55:56 +0100 Subject: [PATCH 053/121] update version number in spec and references to spec --- README.adoc | 2 +- .../openapi/annotations/Components.java | 4 +- .../annotations/ExternalDocumentation.java | 5 +- .../annotations/OpenAPIDefinition.java | 3 +- .../openapi/annotations/Operation.java | 3 +- .../annotations/callbacks/Callback.java | 3 +- .../callbacks/CallbackOperation.java | 3 +- .../annotations/callbacks/Callbacks.java | 3 +- .../openapi/annotations/headers/Header.java | 3 +- .../openapi/annotations/info/Contact.java | 2 +- .../openapi/annotations/info/Info.java | 2 +- .../openapi/annotations/info/License.java | 2 +- .../openapi/annotations/links/Link.java | 3 +- .../openapi/annotations/media/Content.java | 4 +- .../media/DiscriminatorMapping.java | 5 +- .../openapi/annotations/media/Encoding.java | 3 +- .../annotations/media/ExampleObject.java | 3 +- .../openapi/annotations/media/Schema.java | 3 +- .../annotations/media/SchemaProperty.java | 3 +- .../annotations/parameters/Parameter.java | 3 +- .../annotations/parameters/Parameters.java | 3 +- .../annotations/parameters/RequestBody.java | 3 +- .../parameters/RequestBodySchema.java | 4 +- .../annotations/responses/APIResponse.java | 2 +- .../responses/APIResponseSchema.java | 2 +- .../annotations/responses/APIResponses.java | 3 +- .../annotations/security/OAuthFlow.java | 2 +- .../annotations/security/OAuthFlows.java | 2 +- .../annotations/security/OAuthScope.java | 2 +- .../security/SecurityRequirement.java | 5 +- .../security/SecurityRequirements.java | 5 +- .../security/SecurityRequirementsSet.java | 5 +- .../security/SecurityRequirementsSets.java | 5 +- .../annotations/security/SecurityScheme.java | 3 +- .../annotations/security/SecuritySchemes.java | 3 +- .../openapi/annotations/servers/Server.java | 3 +- .../annotations/servers/ServerVariable.java | 5 +- .../openapi/annotations/servers/Servers.java | 3 +- .../openapi/annotations/tags/Tag.java | 3 +- .../openapi/annotations/tags/Tags.java | 3 +- .../openapi/models/Components.java | 4 +- .../openapi/models/ExternalDocumentation.java | 5 +- .../microprofile/openapi/models/OpenAPI.java | 3 +- .../openapi/models/Operation.java | 3 +- .../microprofile/openapi/models/PathItem.java | 10 +- .../microprofile/openapi/models/Paths.java | 6 +- .../openapi/models/callbacks/Callback.java | 3 +- .../openapi/models/examples/Example.java | 3 +- .../openapi/models/headers/Header.java | 3 +- .../openapi/models/info/Contact.java | 2 +- .../openapi/models/info/Info.java | 2 +- .../openapi/models/info/License.java | 2 +- .../openapi/models/links/Link.java | 3 +- .../openapi/models/media/Discriminator.java | 5 +- .../openapi/models/media/Encoding.java | 5 +- .../openapi/models/media/MediaType.java | 4 +- .../openapi/models/media/Schema.java | 3 +- .../openapi/models/media/XML.java | 4 +- .../openapi/models/parameters/Parameter.java | 3 +- .../models/parameters/RequestBody.java | 5 +- .../openapi/models/responses/APIResponse.java | 2 +- .../models/responses/APIResponses.java | 5 +- .../openapi/models/security/OAuthFlow.java | 4 +- .../openapi/models/security/OAuthFlows.java | 2 +- .../models/security/SecurityRequirement.java | 5 +- .../models/security/SecurityScheme.java | 3 +- .../openapi/models/servers/Server.java | 5 +- .../models/servers/ServerVariable.java | 7 +- .../microprofile/openapi/models/tags/Tag.java | 3 +- .../microprofile/openapi/package-info.java | 4 +- .../microprofile-openapi-spec.asciidoc | 120 +++++++++--------- 71 files changed, 162 insertions(+), 204 deletions(-) diff --git a/README.adoc b/README.adoc index 5333be49..57202047 100644 --- a/README.adoc +++ b/README.adoc @@ -21,7 +21,7 @@ image:https://github.com/eclipse/microprofile-open-api/workflows/Build/badge.svg?branch=master[link=https://github.com/eclipse/microprofile-open-api/actions] -This MicroProfile specification aims at providing a unified Java API for the link:++https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md++[OpenAPI v3 specification], +This MicroProfile specification aims at providing a unified Java API for the link:++https://spec.openapis.org/oas/v3.1.0.html++[OpenAPI v3.1 specification], that all application developers can use to expose their API documentation. * The link:++https://github.com/eclipse/microprofile-open-api/tree/master/api/src/main/java/org/eclipse/microprofile/openapi++[spec APIs] are composed of annotations, models, and programming interfaces. diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java index a3f9ae0e..abb1d56c 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java @@ -36,8 +36,8 @@ * Describes the Components object that holds various reusable objects for different aspects of the OpenAPI * Specification (OAS). * - * @see OpenAPI - * Specification Components Object + * @see OpenAPI Specification Components + * Object */ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java index 7a833649..8e115a97 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java @@ -35,9 +35,8 @@ * OpenAPI document root. If more than one non-empty annotation is applied to a type in the application or if the * externalDocs field of the OpenAPIDefinition annotation is supplied the results are not defined. * - * @see OpenAPI - * Specification External Documentation Object + * @see OpenAPI Specification + * External Documentation Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java index 345c979b..2459313f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java @@ -35,8 +35,7 @@ *

* This is the root document object of the OpenAPI document. It contains required and optional fields. * - * @see OpenAPI - * Specification OpenAPI Object + * @see OpenAPI Specification OpenAPI Object */ @Target({ElementType.TYPE, ElementType.PACKAGE}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java index e587bd0f..28b496d0 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java @@ -28,8 +28,7 @@ /** * Describes a single API operation on a path. * - * @see OpenAPI - * Specification Operation Object + * @see OpenAPI Specification Operation Object **/ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java index 26064b76..46a3bb2b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java @@ -29,8 +29,7 @@ /** * This object represents a callback URL that will be invoked. * - * @see OpenAPI - * Specification Callback Object + * @see OpenAPI Specification Callback Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java index 41cdf533..29c85d53 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java @@ -33,8 +33,7 @@ /** * Describes a single API callback operation. * - * @see OpenAPI - * Specification Operation Object + * @see OpenAPI Specification Operation Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java index c41e93a1..dc18f9cd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java @@ -26,8 +26,7 @@ /** * This object represents an array of Callback URLs that can be invoked. * - * @see OpenAPI - * Specification Callback Object + * @see OpenAPI Specification Callback Object **/ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java index 97cb031a..e14a5e8f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java @@ -28,8 +28,7 @@ /** * Describes a single header object * - * @see OpenAPI - * Specification Header Object + * @see OpenAPI Specification Header Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java index 4e59d6c1..483bb174 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java @@ -27,7 +27,7 @@ /** * Contact information for the exposed API. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#contactObject" + * @see OpenAPI Specification Contact Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java index 5473efa2..9fa09ed8 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java @@ -27,7 +27,7 @@ /** * This annotation provides metadata about the API, and maps to the Info object in OpenAPI Specification 3. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#infoObject" + * @see OpenAPI Specification Info Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java index 99c3f561..a566daf2 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java @@ -27,7 +27,7 @@ /** * License information for the exposed API. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#licenseObject" + * @see OpenAPI Specification License Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java index 456bf55a..b46fef51 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java @@ -30,8 +30,7 @@ * caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between * responses and other operations. * - * @see OpenAPI - * Specification Link Object + * @see OpenAPI Specification Link Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java index 7d09b708..776c89e2 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java @@ -27,8 +27,8 @@ /** * This object provides schema and examples for a particular media type. * - * @see OpenAPI - * Specification Media Type Object + * @see OpenAPI Specification Media Type + * Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java index 749fc5eb..9f9ed844 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java @@ -25,9 +25,8 @@ /** * This object maps payload values to a particular Schema. * - * @see OpenAPI - * Specification Discriminator Object + * @see OpenAPI Specification Discriminator + * Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java index 036e3ce5..7d5dd78d 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java @@ -28,8 +28,7 @@ /** * Single encoding definition to be applied to single Schema Object * - * @see Encoding - * Object + * @see OpenAPI Specification Encoding Object **/ @Target({}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java index fda821c9..1dd530ed 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java @@ -27,8 +27,7 @@ /** * This object illustrates an example of a particular content * - * @see OpenAPI - * Specification Example Object + * @see OpenAPI Specification Example Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java index d5533585..109d903c 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java @@ -31,8 +31,7 @@ * The Schema Object allows the definition of input and output data types. These types can be objects, but also * primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. * - * @see OpenAPI - * Specification Schema Object + * @see OpenAPI Specification Schema Object **/ @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java index e603b2bc..62b72c16 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java @@ -31,8 +31,7 @@ * * This object is an extended subset of the JSON Schema Specification Wright Draft 00. * - * @see OpenAPI - * Specification Schema Object + * @see OpenAPI Specification Schema Object * * @since 2.0 **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java index 6ea8f517..634e0af5 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java @@ -35,8 +35,7 @@ /** * Describes a single operation parameter * - * @see OpenAPI - * Specification Parameter Object + * @see OpenAPI Specification Parameter Object **/ @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java index e41d0d70..d06cddf3 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java @@ -26,8 +26,7 @@ /** * This object encapsulates input parameters * - * @see OpenAPI - * Specification Parameter Object + * @see OpenAPI Specification Parameter Object */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java index c04ed72e..0f07d832 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java @@ -29,8 +29,7 @@ /** * Describes a single request body. * - * @see requestBody + * @see OpenAPI Specification Request Body * Object **/ @Target({ElementType.PARAMETER, ElementType.METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java index 1bcea852..ffeeb4fc 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java @@ -58,8 +58,8 @@ * * * @see RequestBody - * @see OpenAPI - * requestBody Object + * @see OpenAPI Specification Request Body + * Object **/ @Target({ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index 6f666036..87cbb817 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -69,7 +69,7 @@ * } * * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject" + * @see OpenAPI Specification Response Object * **/ @Target({ElementType.METHOD, ElementType.TYPE}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java index 0a2f5642..a968d26e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java @@ -58,7 +58,7 @@ * * @since 2.0 * @see APIResponse - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject" + * @see OpenAPI Specification Response Object * **/ @Target({ElementType.METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java index 31dde7ef..da519359 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java @@ -28,8 +28,7 @@ * The ApiResponses annotation is a container for @ApiResponse annotations. When used on a method it is treated as if * each ApiResponse annotation were applied individually. * - * @see Responses - * Object + * @see OpenAPI Specification Responses Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java index c2c0cdc8..10ab2407 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java @@ -27,7 +27,7 @@ /** * Configuration details for a supported OAuth Flow. * - * @see OAuth Flow + * @see OpenAPI Specification OAuth Flow * Object **/ @Target({}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java index 6c6907b4..593ce3fb 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java @@ -27,7 +27,7 @@ /** * Allows configuration of the supported OAuth Flows. * - * @see OAuthFlows + * @see OpenAPI Specification OAuth Flows * Object **/ @Target({}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java index 42833aea..03343008 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java @@ -25,7 +25,7 @@ /** * Represents an OAuth scope. * - * @see OAuthFlow + * @see OpenAPI Specification OAuth Flow * Object **/ @Target({}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java index 78e37121..62bd8f8e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java @@ -30,9 +30,8 @@ * Applying this annotation to a method or class is equivalent to applying a {@link SecurityRequirementsSet} annotation * containing only this annotation. * - * @see SecuirtyRequirement - * Object + * @see OpenAPI Specification Security + * Requirement Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java index d0a8b803..0fe8fb5f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java @@ -35,9 +35,8 @@ * - api_secret: [] * * - * @see SecurityRequirement - * Object + * @see OpenAPI Specification Security + * Requirement Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java index db420077..3bd85b21 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java @@ -53,9 +53,8 @@ * oauth_implicit: [] * * - * @see SecurityRequirement - * Object + * @see OpenAPI Specification Security + * Requirement Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSets.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSets.java index 1d8b4a6e..4ca0cdcd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSets.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSets.java @@ -49,9 +49,8 @@ * - api_secret: [] * * - * @see SecurityRequirement - * Object + * @see OpenAPI Specification Security + * Requirement Object **/ @Retention(RUNTIME) @Target({TYPE, METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java index 1610cb29..5155f134 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java @@ -33,7 +33,8 @@ * (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) * as defined in RFC6749, and OpenID Connect Discovery. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#security-scheme-object" + * @see OpenAPI Specification Security Scheme + * Object **/ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java index f61c69ec..e0064b6b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java @@ -25,7 +25,8 @@ /** * This object represents an array of SecurityScheme annotations that can be specified at the definition level. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#security-scheme-object" + * @see OpenAPI Specification Security Scheme + * Object **/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java index eaffd8fe..74163d34 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java @@ -42,8 +42,7 @@ * {@link org.eclipse.microprofile.openapi.annotations.servers.Servers Servers} annotation are specified on the same * type, the server definitions will be combined. * - * @see OpenAPI - * Specification Server Object + * @see OpenAPI Specification Server Object **/ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java index ef157eeb..0417f372 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java @@ -27,9 +27,8 @@ /** * An object representing a Server Variable for server URL template substitution. * - * @see ServerVariable - * Object + * @see OpenAPI Specification Server + * Variable Object **/ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java index 11889360..8e5526ca 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java @@ -31,8 +31,7 @@ * {@link org.eclipse.microprofile.openapi.annotations.servers.Servers Servers} annotation are specified on the same * type, the server definitions will be combined. * - * @see Server - * Object + * @see OpenAPI Specification Server Object * */ @Target({ElementType.TYPE, ElementType.METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java index c17fd6ac..34f8fcee 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java @@ -68,8 +68,7 @@ * } * * - * @see OpenAPI - * Specification Tag Object + * @see OpenAPI Specification Tag Object */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java index 3c05eecd..9a85ad1e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java @@ -31,8 +31,7 @@ * {@link org.eclipse.microprofile.openapi.annotations.tags.Tags Tags} annotations are specified on the same * method/class, then both tag definitions should be applied to method/class. * - * @see OpenAPI - * Specification Tag Object + * @see OpenAPI Specification Tag Object * */ @Target({ElementType.TYPE, ElementType.METHOD}) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java index f68310ea..174af0d4 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java @@ -47,8 +47,8 @@ *

  • my.org.User
  • * * - * @see OpenAPI - * Specification Components Object + * @see OpenAPI Specification Components + * Object */ public interface Components extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/ExternalDocumentation.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/ExternalDocumentation.java index 1022bf59..dc3c0a13 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/ExternalDocumentation.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/ExternalDocumentation.java @@ -23,9 +23,8 @@ * Allows referencing an external resource for extended documentation. *

    * - * @see OpenAPI - * Specification External Documentation Object + * @see OpenAPI Specification + * External Documentation Object */ public interface ExternalDocumentation extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java index 3433674e..23ab72a3 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java @@ -29,8 +29,7 @@ *

    * This is the root document object of the OpenAPI document. It contains required and optional fields. * - * @see OpenAPI - * Specification OpenAPI Object + * @see OpenAPI Specification OpenAPI Object */ public interface OpenAPI extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Operation.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Operation.java index b1bedad4..48b431c8 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Operation.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Operation.java @@ -33,8 +33,7 @@ * Describes a single API operation on a path. *

    * - * @see OpenAPI - * Specification Operation Object + * @see OpenAPI Specification Operation Object */ public interface Operation extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java index e611e438..e2838929 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/PathItem.java @@ -27,13 +27,13 @@ * PathItem *

    * Describes the operations available on a single path. A Path Item MAY be empty, due to - * security - * constraints. In that case the path itself is still exposed to the documentation viewer but you will not know - * which operations and parameters are available. + * security constraints. In that case the + * path itself is still exposed to the documentation viewer but you will not know which operations and parameters are + * available. *

    * - * @see OpenAPI - * Specification Path Item Object + * @see OpenAPI Specification Path Item + * Object */ public interface PathItem extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java index 100a644e..3d9545d6 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Paths.java @@ -24,12 +24,10 @@ *

    * Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the * Server Object in order to construct the full URL. The Paths MAY be empty, due to - * security - * constraints. + * security constraints. *

    * - * @see OpenAPI - * Specification Paths Object + * @see OpenAPI Specification Paths Object */ public interface Paths extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/callbacks/Callback.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/callbacks/Callback.java index 4c058d9c..e888cc7a 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/callbacks/Callback.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/callbacks/Callback.java @@ -32,8 +32,7 @@ * used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the * callback operation. * - * @see OpenAPI - * Specification Callback Object + * @see OpenAPI Specification Callback Object */ public interface Callback extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/examples/Example.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/examples/Example.java index 1b118518..6b295cd3 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/examples/Example.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/examples/Example.java @@ -29,8 +29,7 @@ * In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling * implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible. * - * @see OpenAPI - * Specification Example Object + * @see OpenAPI Specification Example Object */ public interface Example extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/headers/Header.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/headers/Header.java index a85d9004..ea4980c9 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/headers/Header.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/headers/Header.java @@ -32,8 +32,7 @@ * Describes a single header parameter for an operation. *

    * - * @see OpenAPI - * Specification Header Object + * @see OpenAPI Specification Header Object */ public interface Header extends Constructible, Extensible

    , Reference
    { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Contact.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Contact.java index d1f1b4aa..ba26e1dd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Contact.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Contact.java @@ -23,7 +23,7 @@ /** * This interface represents the Contact information for the exposed API. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#contactObject" + * @see OpenAPI Specification Contact Object */ public interface Contact extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java index 0005a02b..03f6231b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java @@ -24,7 +24,7 @@ * This interface represents all the metadata about the API. The metadata may be used by clients if needed, and may be * presented in editing or documentation tools. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#infoObject" + * @see OpenAPI Specification Info Object */ public interface Info extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java index 7844ec48..a0f204f2 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java @@ -23,7 +23,7 @@ /** * This interface represents the License information for the exposed API. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#licenseObject" + * @see OpenAPI Specification License Object */ public interface License extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/links/Link.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/links/Link.java index dd172f59..fbf2975b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/links/Link.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/links/Link.java @@ -39,8 +39,7 @@ * operationRef syntax is preferred for specifications with external references. *

    * - * @see OpenAPI - * Specification Link Object + * @see OpenAPI Specification Link Object */ public interface Link extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Discriminator.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Discriminator.java index 5bb4fa41..461241c1 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Discriminator.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Discriminator.java @@ -30,9 +30,8 @@ * it. *

    * - * @see OpenAPI - * Specification Discriminator Object + * @see OpenAPI Specification Discriminator + * Object */ public interface Discriminator extends Constructible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Encoding.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Encoding.java index a5b55727..6f966163 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Encoding.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Encoding.java @@ -26,8 +26,7 @@ /** * Encoding * - * @see Encoding - * Object + * @see OpenAPI Specification Encoding Object */ public interface Encoding extends Constructible, Extensible { @@ -267,4 +266,4 @@ default Encoding allowReserved(Boolean allowReserved) { */ void setAllowReserved(Boolean allowReserved); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/MediaType.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/MediaType.java index 27ecf2e0..9a5d94b3 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/MediaType.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/MediaType.java @@ -29,8 +29,8 @@ * Each Media Type Object provides a schema and examples for the media type identified by its key. *

    * - * @see OpenAPI - * Specification Media Type Object + * @see OpenAPI Specification Media Type + * Object */ public interface MediaType extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 6a7e45bb..9e95aa0b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -39,8 +39,7 @@ * Any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing an * existing definition instead of defining the same Schema again. * - * @see OpenAPI - * Specification Schema Object + * @see OpenAPI Specification Schema Object */ public interface Schema extends Extensible, Constructible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java index 2b9fafd4..f0851fe4 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/XML.java @@ -24,7 +24,7 @@ * A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are not * inferred (for singular/plural forms) and the name property SHOULD be used to add that information. * - * @see XML Object + * @see OpenAPI Specification XML Object */ public interface XML extends Constructible, Extensible { @@ -221,4 +221,4 @@ default XML wrapped(Boolean wrapped) { return this; } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/Parameter.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/Parameter.java index f3472850..bd22a363 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/Parameter.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/Parameter.java @@ -49,8 +49,7 @@ * For more complex scenarios, the content property can define the media type and schema of the parameter. A parameter * must contain either a schema property, or a content property, but not both. * - * @see OpenAPI - * Specification Parameter Object + * @see OpenAPI Specification Parameter Object */ public interface Parameter extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/RequestBody.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/RequestBody.java index 14ffcee9..1867087c 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/RequestBody.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/parameters/RequestBody.java @@ -25,8 +25,7 @@ /** * This interface represents the request body of an operation in which body parameters can be specified. * - * @see requestBody + * @see OpenAPI Specification Request Body * Object */ public interface RequestBody extends Constructible, Extensible, Reference { @@ -124,4 +123,4 @@ default RequestBody required(Boolean required) { return this; } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponse.java index 72e459ba..865b009e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponse.java @@ -30,7 +30,7 @@ * This interface represents a single response from an API Operation, including design-time, static links to operations * based on the response. * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject" + * @see OpenAPI Specification Response Object */ public interface APIResponse extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponses.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponses.java index 674482b8..eb17f299 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponses.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/responses/APIResponses.java @@ -26,8 +26,7 @@ * This interface represents the container for the expected responses of an operation. The container maps a HTTP * response code to the expected response. * - * @see Responses - * Object + * @see OpenAPI Specification Responses Object */ public interface APIResponses extends Constructible, Extensible { @@ -141,4 +140,4 @@ default APIResponses defaultValue(APIResponse defaultValue) { return this; } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlow.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlow.java index bfc279d4..cb1964ec 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlow.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlow.java @@ -25,7 +25,7 @@ /** * Configuration details for a supportde OAuthFlow * - * @see OAuth Flow + * @see OpenAPI Specification OAuth Flow * Object */ public interface OAuthFlow extends Constructible, Extensible { @@ -224,4 +224,4 @@ default OAuthFlow scopes(Map scopes) { **/ Map getScopes(); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlows.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlows.java index 646c7d46..39143446 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlows.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/OAuthFlows.java @@ -23,7 +23,7 @@ /** * Configuration of the supported OAuthFlows * - * @see OAuthFlows + * @see OpenAPI Specification OAuth Flows * Object */ public interface OAuthFlows extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java index 37f253cc..d4d3a1b8 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java @@ -25,9 +25,8 @@ /** * SecurityRequirement * - * @see SecurityRequirement - * Object + * @see OpenAPI Specification Security + * Requirement Object */ public interface SecurityRequirement extends Constructible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java index e6269ed1..b45a0178 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityScheme.java @@ -24,7 +24,8 @@ /** * SecurityScheme * - * @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#security-scheme-object" + * @see OpenAPI Specification Security Scheme + * Object */ public interface SecurityScheme extends Constructible, Extensible, Reference { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/Server.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/Server.java index 62947c9b..21be1e1f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/Server.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/Server.java @@ -25,8 +25,7 @@ /** * An object representing a server. * - * @see Server - * Object + * @see OpenAPI Specification Server Object */ public interface Server extends Constructible, Extensible { @@ -178,4 +177,4 @@ default Server variables(Map variables) { setVariables(variables); return this; } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java index d97697d4..ea8b5e8e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/servers/ServerVariable.java @@ -25,9 +25,8 @@ /** * An object representing a Server Variable for server URL template substitution. * - * @see ServerVariable - * Object + * @see OpenAPI Specification Server + * Variable Object */ public interface ServerVariable extends Constructible, Extensible { @@ -166,4 +165,4 @@ default ServerVariable description(String description) { return this; } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/tags/Tag.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/tags/Tag.java index d69e833c..915db28f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/tags/Tag.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/tags/Tag.java @@ -26,8 +26,7 @@ *

    * An object to store metadata to be available in the OpenAPI document. * - * @see OpenAPI - * Specification Tag Object + * @see OpenAPI Specification Tag Object */ public interface Tag extends Constructible, Extensible { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java index 6684dbd8..0718528e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/package-info.java @@ -13,9 +13,9 @@ /** * A set of Java interfaces, annotations and programming models which allow Java developers to natively produce OpenAPI - * v3 documents from their Jakarta REST applications. + * v3.1 documents from their Jakarta REST applications. */ @org.osgi.annotation.versioning.Version("2.1") @org.osgi.annotation.versioning.ProviderType -package org.eclipse.microprofile.openapi; \ No newline at end of file +package org.eclipse.microprofile.openapi; diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index f2b8c3d3..f0879094 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -45,12 +45,12 @@ anywhere: on-premises, private cloud, public cloud, etc. For the clients and providers of these services to connect there needs to be a clear and complete contract. Similar to the WSDL contract for legacy Web Services, -the https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md[OpenAPI v3] specification is the contract for +the https://spec.openapis.org/oas/v3.1.0.html[OpenAPI v3.1] specification is the contract for 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 +OpenAPI v3.1 documents from their applications written using Jakarta RESTful Web Services (Jakarta REST). == Architecture @@ -72,8 +72,8 @@ which means that vendors implementing the MP OpenAPI specification must also imp the MP Config specification. There are various ways to inject these configuration values into an MP OpenAPI -framework, including the https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/configsources.asciidoc#default-configources[default ConfigSource] as well as -https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/configsources.asciidoc#custom-configsources[custom ConfigSource]. +framework, including the https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#default_configsources[default ConfigSource] as well as +https://download.eclipse.org/microprofile/microprofile-config-3.1/microprofile-config-spec-3.1.html#custom_configsources[custom ConfigSource]. Vendors implementing the MP OpenAPI specification can optionally provide additional native ways for these configuration values to be injected into the framework @@ -89,7 +89,7 @@ framework-specific values for configurations that affect implementation behavior For convenience of vendors (and application developers using custom ConfigSources), the full list of supported configuration keys is available as constants in the -https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/OASConfig.java[OASConfig] class. +https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/OASConfig.java[OASConfig] class. ==== Core configurations @@ -205,7 +205,7 @@ been built from the previously described documentation mechanisms. === Annotations -Many of these OpenAPI v3 annotations were derived from the https://github.com/swagger-api/swagger-core[Swagger Core] library, which +Many of these annotations were derived from the https://github.com/swagger-api/swagger-core[Swagger Core] library, which allows for a mostly-mechanical transformation of applications that are using that library and wish to take advantage to the official MP OpenAPI interfaces. @@ -217,52 +217,52 @@ The following annotations are found in the https://github.com/eclipse/microprofi |=== | Annotation | Description -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java[@Callback] | Represents a callback URL that will be invoked. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java[@Callbacks] | Represents an array of Callback URLs that can be invoked. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java[@CallbackOperation] | Represents an operation that will be invoked during the callback. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java[@Components] | A container that holds various reusable objects for different aspects of the OpenAPI Specification. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/Explode.java[@Explode] | Enumeration used to define the value of the `explode` property. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/ParameterIn.java[@ParameterIn] | Enumeration representing the parameter's `in` property. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/ParameterStyle.java[@ParameterStyle] | Enumeration for the parameter's `style` property. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeIn.java[@SecuritySchemeIn] | Enumeration for the security scheme's `in` property. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java[@SecuritySchemeType] | Enumeration for the security scheme's `type` property. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/extensions/Extension.java[@Extension] | Adds an extension with contained properties. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/extensions/Extensions.java[@Extensions] | Adds custom properties to an extension. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java[@ExternalDocumentation] | References an external resource for extended documentation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java[@Header] | Describes a single header object. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java[@Contact] | Contact information for the exposed API. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java[@Info] | This annotation encapsulates metadata about the API. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java[@License] | License information for the exposed API. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java[@Link] | Represents a design-time link for a response. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/LinkParameter.java[@LinkParameter] | Represents a parameter to pass to the linked operation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java[@Content] | Provides schema and examples for a particular media type. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java[@DiscriminatorMapping] | Used to differentiate between other schemas which may satisfy the payload description. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java[@Encoding] | Single encoding definition to be applied to single Schema Object. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java[@ExampleObject] | Illustrates an example of a particular content. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java[@Schema] | Allows the definition of input and output data types. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java[@SchemaProperty] | Allows the definition of a property nested within a parent @Schema. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java[@OpenAPIDefinition] | General metadata for an OpenAPI definition. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java[@Operation] | Describes an operation or typically a HTTP method against a specific path. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java[@Parameter] | Describes a single operation parameter. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java[@Parameters] | Encapsulates input parameters. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java[@RequestBody] | Describes a single request body. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java[@RequestBodySchema] | Describes a single request body with schema implementation class. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java[@APIResponse] | Describes a single response from an API operation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java[@APIResponses] | A container for multiple responses from an API operation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java[@APIResponseSchema] | Describes a single response with schema implementation class from an API operation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java[@OAuthFlow] | Configuration details for a supported OAuth Flow. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java[@OAuthFlows] | Allows configuration of the supported OAuth Flows. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java[@OAuthScope] | Represents an OAuth scope. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java[@SecurityRequirement] | Specifies a security requirement for an operation. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java[@SecurityRequirements] | Represents an array of security requirements where only one needs to be satisfied. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java[@SecurityRequirementsSet] | Represents an array of security requirements that need to be satisfied. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java[@SecurityScheme] | Defines a security scheme that can be used by the operations. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java[@SecuritySchemes] | Represents an array of security schemes that can be specified. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java[@Server]| Represents a server used in an operation or used by all operations in an OpenAPI document. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java[@Servers] | A container for multiple server definitions. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java[@ServerVariable] | Represents a server variable for server URL template substitution. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java[@Tag] | Represents a tag for the API endpoint. -| https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java[@Tags] | A container of multiple tags. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java[@Callback] | Represents a callback URL that will be invoked. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callbacks.java[@Callbacks] | Represents an array of Callback URLs that can be invoked. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/CallbackOperation.java[@CallbackOperation] | Represents an operation that will be invoked during the callback. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java[@Components] | A container that holds various reusable objects for different aspects of the OpenAPI Specification. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/Explode.java[@Explode] | Enumeration used to define the value of the `explode` property. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/ParameterIn.java[@ParameterIn] | Enumeration representing the parameter's `in` property. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/ParameterStyle.java[@ParameterStyle] | Enumeration for the parameter's `style` property. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeIn.java[@SecuritySchemeIn] | Enumeration for the security scheme's `in` property. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/enums/SecuritySchemeType.java[@SecuritySchemeType] | Enumeration for the security scheme's `type` property. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/extensions/Extension.java[@Extension] | Adds an extension with contained properties. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/extensions/Extensions.java[@Extensions] | Adds custom properties to an extension. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/ExternalDocumentation.java[@ExternalDocumentation] | References an external resource for extended documentation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java[@Header] | Describes a single header object. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Contact.java[@Contact] | Contact information for the exposed API. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java[@Info] | This annotation encapsulates metadata about the API. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java[@License] | License information for the exposed API. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java[@Link] | Represents a design-time link for a response. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/LinkParameter.java[@LinkParameter] | Represents a parameter to pass to the linked operation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java[@Content] | Provides schema and examples for a particular media type. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java[@DiscriminatorMapping] | Used to differentiate between other schemas which may satisfy the payload description. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java[@Encoding] | Single encoding definition to be applied to single Schema Object. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java[@ExampleObject] | Illustrates an example of a particular content. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java[@Schema] | Allows the definition of input and output data types. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java[@SchemaProperty] | Allows the definition of a property nested within a parent @Schema. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java[@OpenAPIDefinition] | General metadata for an OpenAPI definition. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Operation.java[@Operation] | Describes an operation or typically a HTTP method against a specific path. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java[@Parameter] | Describes a single operation parameter. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java[@Parameters] | Encapsulates input parameters. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java[@RequestBody] | Describes a single request body. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java[@RequestBodySchema] | Describes a single request body with schema implementation class. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java[@APIResponse] | Describes a single response from an API operation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java[@APIResponses] | A container for multiple responses from an API operation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java[@APIResponseSchema] | Describes a single response with schema implementation class from an API operation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlow.java[@OAuthFlow] | Configuration details for a supported OAuth Flow. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthFlows.java[@OAuthFlows] | Allows configuration of the supported OAuth Flows. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/OAuthScope.java[@OAuthScope] | Represents an OAuth scope. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java[@SecurityRequirement] | Specifies a security requirement for an operation. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirements.java[@SecurityRequirements] | Represents an array of security requirements where only one needs to be satisfied. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirementsSet.java[@SecurityRequirementsSet] | Represents an array of security requirements that need to be satisfied. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java[@SecurityScheme] | Defines a security scheme that can be used by the operations. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecuritySchemes.java[@SecuritySchemes] | Represents an array of security schemes that can be specified. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Server.java[@Server]| Represents a server used in an operation or used by all operations in an OpenAPI document. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/Servers.java[@Servers] | A container for multiple server definitions. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/servers/ServerVariable.java[@ServerVariable] | Represents a server variable for server URL template substitution. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java[@Tag] | Represents a tag for the API endpoint. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tags.java[@Tags] | A container of multiple tags. |=== ===== Overrides @@ -660,9 +660,9 @@ complete set of models are found in the https://github.com/eclipse/microprofile- ==== OASFactory -The https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/OASFactory.java[OASFactory] is used to create all of the elements of an OpenAPI tree. +The https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/OASFactory.java[OASFactory] is used to create all of the elements of an OpenAPI tree. -For example, the following snippet creates a simple https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java[Info] element that contains a title, description, and version. +For example, the following snippet creates a simple https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java[Info] element that contains a title, description, and version. [source,java] ---- @@ -671,7 +671,7 @@ OASFactory.createObject(Info.class).title("Airlines").description("Airlines APIs ==== OASModelReader -The https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/OASModelReader.java[OASModelReader] interface allows application developers to bootstrap the OpenAPI model tree +The https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/OASModelReader.java[OASModelReader] interface allows application developers to bootstrap the OpenAPI model tree used by the processing framework. To use it, simply create an implementation of this interface and register it using the `mp.openapi.model.reader` configuration key, where the value is the fully qualified name of the reader class. @@ -700,7 +700,7 @@ which is called once after all other documentation mechanisms have completed. ==== OASFilter -The https://github.com/eclipse/microprofile-open-api/blob/master/api/src/main/java/org/eclipse/microprofile/openapi/OASFilter.java[OASFilter] interface allows application developers +The https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/OASFilter.java[OASFilter] interface allows application developers to receive callbacks for various key OpenAPI elements. The interface has a default implementation for every method, which allows application developers to only override the methods they care about. To use it, simply create an implementation of @@ -787,8 +787,8 @@ where the value can be either `JSON` or `YAML`, to facilitate the toggle between the default `YAML` format and `JSON` format. === Context root behavior -Vendors are required to ensure that the combination of each global https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#serverObject[server] -element and https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject[pathItem] element resolve to the absolute backend URL of that +Vendors are required to ensure that the combination of each global https://spec.openapis.org/oas/v3.1.0.html#server-object[server] +element and https://spec.openapis.org/oas/v3.1.0.html#path-item-object[pathItem] element resolve to the absolute backend URL of that particular path. If that `pathItem` contains a `servers` element , then this list of operation-level `server` elements replaces the global list of servers for that particular `pathItem`. @@ -825,7 +825,7 @@ It is common that a microservice (A) using MicroProfile OpenAPI will also use ht to make outbound calls into another microservice (B). In this case, we do not want the interface for microservice (B) to appear in microservice (A)'s OAS3 document. -Therefore, vendors are required to exclude from the final OAS3 document any interface annotated with https://github.com/eclipse/microprofile-rest-client/blob/master/api/src/main/java/org/eclipse/microprofile/rest/client/inject/RegisterRestClient.java[org.eclipse.microprofile.rest.client.inject.RegisterRestClient]. +Therefore, vendors are required to exclude from the final OAS3 document any interface annotated with https://download.eclipse.org/microprofile/microprofile-rest-client-3.0/apidocs/org/eclipse/microprofile/rest/client/inject/RegisterRestClient.html[org.eclipse.microprofile.rest.client.inject.RegisterRestClient]. == Limitations @@ -841,7 +841,7 @@ processed languages can be kept to improve performance. === Validation The MP OpenAPI specification does not mandate vendors to validate the resulting -OpenAPI v3 model (after processing the 5 steps previously mentioned), which means +OpenAPI v3.1 model (after processing the 5 steps previously mentioned), which means that the behavior of invalid models is vendor specific (i.e. vendors may choose to ignore, reject, or pass-through invalid inputs). From 9e6909bcf17d5c823011c70e50e3e7c728a93466 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 9 May 2024 10:30:01 +0100 Subject: [PATCH 054/121] add identifer attribute to licence --- .../openapi/annotations/info/License.java | 7 +++++ .../openapi/models/info/License.java | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java index 99c3f561..a23beb70 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java @@ -40,6 +40,13 @@ **/ String name(); + /** + * The license identifier used for the API. + * + * @return the identifier of the license + **/ + String identifier() default ""; + /** * A URL to the license used for the API. MUST be in the format of a URL. * diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java index 7844ec48..b0e73131 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java @@ -54,6 +54,33 @@ default License name(String name) { return this; } + /** + * Returns the license identifier for this License instance that is used for the API. + * + * @return the license identifier used for the API + **/ + String getIdentifier(); + + /** + * Sets the license identifier for this License instance that is used for the API. + * + * @param identifier + * the license identifier used for the API + */ + void setIdentifier(String identifier); + + /** + * Sets this License instance's identifier used for the API and returns this instance of License. + * + * @param identifier + * the license identifier used for the API + * @return this License instance + */ + default License identifier(String identifier) { + setIdentifier(identifier); + return this; + } + /** * Returns the URL for this License instance that is used for the API. * From 3e561538f8f3e9834728045016c69a7d5910f2a8 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 9 May 2024 10:30:09 +0100 Subject: [PATCH 055/121] test identifer attribute in licence --- .../openapi/apps/petstore/PetStoreApp.java | 2 +- .../microprofile/openapi/tck/OASFactoryErrorTest.java | 7 +++++++ .../microprofile/openapi/tck/PetStoreAppTest.java | 10 ++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java index 80de4891..92792221 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/PetStoreApp.java @@ -35,7 +35,7 @@ @ApplicationPath("/") @OpenAPIDefinition(info = @Info(title = "Pet Store App", version = "2.0", description = "Pet Store App API", license = @License(name = "Apache 2.0", - url = "http://www.apache.org/licenses/LICENSE-2.0.html"), + identifier = "Apache-2.0"), contact = @Contact(name = "PetStore API Support", url = "https://github.com/eclipse/microprofile-open-api", email = "support@petstore.com"), diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java index 738b1293..b8d6eaaa 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java @@ -72,6 +72,13 @@ public void setUrl(String url) { public License url(String url) { return null; } + @Override + public String getIdentifier() { + return null; + } + @Override + public void setIdentifier(String identifier) { + } } @Deployment diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java index 2bcfd711..1a021ec7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/PetStoreAppTest.java @@ -47,6 +47,16 @@ public static WebArchive createDeployment() { .addPackages(true, "org.eclipse.microprofile.openapi.apps.petstore"); } + // This test covers basic OpenAPI ingredients like licenses, if something is here instead of tested in the + // AirlinesApp + // It is likely because it is mutually exclusive with something in the AirlinesApp + @Test(dataProvider = "formatProvider") + public void testOpenAPIEssentials(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("info.license.identifier", equalTo("Apache-2.0")); + } + @Test(dataProvider = "formatProvider") public void testSchema(String type) { ValidatableResponse vr = callEndpoint(type); From 799d15d353652e2d3a6b2bec3506beaf1a51f21d Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Wed, 15 May 2024 16:28:42 +0100 Subject: [PATCH 056/121] operation without resources --- .../microprofile/openapi/tck/AirlinesAppTest.java | 8 ++++++++ tck/src/main/resources/openapi.yaml | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index b83d3bb2..966d71d3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -1042,6 +1042,14 @@ public void testStaticFileDefinitions(String type) { vr.body(callbacksPath + ".responses.'204'.description", both(containsString("Your server should return this HTTP status code if no longer interested")) .and(containsString("in further updates"))); + + // Test an operation with no responses + String noResponsePath = "paths.'/streams'.get"; + vr.body(noResponsePath + ".description", equalTo("An operation without a response")); + vr.body(noResponsePath + ".parameters[0].name", equalTo("callbackUrl")); + vr.body(noResponsePath + ".parameters[0].description", + equalTo("the location where data will be sent. Must be network accessible\n" + + "by the source server\n")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/resources/openapi.yaml b/tck/src/main/resources/openapi.yaml index 6f0a7657..51c6c8ca 100644 --- a/tck/src/main/resources/openapi.yaml +++ b/tck/src/main/resources/openapi.yaml @@ -18,6 +18,20 @@ info: version: 1.0.0 paths: /streams: + get: + description: An operation without a response + parameters: + - name: callbackUrl + in: query + required: true + description: | + the location where data will be sent. Must be network accessible + by the source server + schema: + type: string + format: uri + examples: + - https://tonys-server.com post: description: subscribes a client to receive out-of-band data parameters: From 7a5fb718c682fa68cf6f1b29ddc1754744650f9d Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 9 May 2024 15:04:34 +0100 Subject: [PATCH 057/121] Add webhooks to the model API --- .../microprofile/openapi/models/OpenAPI.java | 52 +++++++++++++++++++ .../openapi/models/package-info.java | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java index 23ab72a3..eed5b428 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/OpenAPI.java @@ -18,6 +18,7 @@ package org.eclipse.microprofile.openapi.models; import java.util.List; +import java.util.Map; import org.eclipse.microprofile.openapi.models.info.Info; import org.eclipse.microprofile.openapi.models.security.SecurityRequirement; @@ -275,6 +276,57 @@ default OpenAPI paths(Paths paths) { return this; } + /** + * Returns the webhooks property of this OpenAPI instance. + * + * @return a copy Map (potentially immutable) of named webhook definitions + * @since 4.0 + */ + Map getWebhooks(); + + /** + * Sets the webhooks property of this OpenAPI instance. + * + * @param webhooks + * a map of named webhook definitions + * @since 4.0 + */ + void setWebhooks(Map webhooks); + + /** + * Sets the webhooks property of this OpenAPI instance. + * + * @param webhooks + * a map of named webhook definitions + * @return the current Schema instance + * @since 4.0 + */ + default OpenAPI webhooks(Map webhooks) { + setWebhooks(webhooks); + return this; + } + + /** + * Adds a webhook definition. + * + * @param name + * unique name of the webhook to add + * @param webhook + * webhook definition to add + * @return the current Schema instance + * @since 4.0 + */ + OpenAPI addWebhook(String name, PathItem webhook); + + /** + * Removes a webhook definition. + * + * @param name + * unique name of the webhook to remove + * @since 4.0 + */ + void removeWebhook(String name); + /** * Returns the components property from an OpenAPI instance. * diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java index 126d8659..f29b8077 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/package-info.java @@ -40,6 +40,6 @@ * */ -@org.osgi.annotation.versioning.Version("2.0") +@org.osgi.annotation.versioning.Version("2.1") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.models; \ No newline at end of file From 61eb86464f30773d0709cb558e21c3300975b130 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 9 May 2024 16:30:37 +0100 Subject: [PATCH 058/121] Add webhook model API TCKs --- .../openapi/reader/MyOASModelReaderImpl.java | 23 +++++++++++++++++++ .../openapi/tck/ModelReaderAppTest.java | 22 ++++++++++++++++++ .../openapi/tck/StaticDocumentTest.java | 17 ++++++++++++++ tck/src/main/resources/simpleapi.yaml | 22 ++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 45ce98a3..dd3ab4a1 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -255,6 +255,29 @@ public OpenAPI buildModel() { .externalDocs(OASFactory.createObject(ExternalDocumentation.class) .description("instructions for how to deploy this app") .url("https://github.com/microservices-api/oas3-airlines/blob/master/README.md")) + .addWebhook("bookingEvent", OASFactory.createPathItem() + .PUT(OASFactory.createOperation() + .summary("Notifies that a booking has been created") + .requestBody(OASFactory.createRequestBody() + .content(OASFactory.createContent() + .addMediaType("application/json", OASFactory.createMediaType() + .schema(OASFactory.createSchema() + .ref("#/components/schemas/Booking"))))) + .responses(OASFactory.createAPIResponses() + .addAPIResponse("204", OASFactory.createAPIResponse() + .description( + "Indicates that the creation event was processed successfully")))) + .DELETE(OASFactory.createOperation() + .summary("Notifies that a booking has been deleted") + .requestBody(OASFactory.createRequestBody() + .content(OASFactory.createContent() + .addMediaType("application/json", OASFactory.createMediaType() + .schema(OASFactory.createSchema() + .ref("#/components/schemas/Booking"))))) + .responses(OASFactory.createAPIResponses() + .addAPIResponse("204", OASFactory.createAPIResponse() + .description( + "Indicates that the deletion event was processed successfully"))))) .paths(OASFactory.createObject(Paths.class) .addPathItem("/modelReader/airlines", OASFactory.createObject(PathItem.class) .GET(OASFactory.createObject(Operation.class) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index ae928428..c3bc3d86 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -346,4 +346,26 @@ public void testContentInAPIResponse(String type) { vr.body(content1 + ".schema.type", itemOrSingleton("array")); vr.body(content1 + ".schema.items", notNullValue()); } + + @Test(dataProvider = "formatProvider") + public void testWebhooks(String type) { + ValidatableResponse vr = callEndpoint(type); + + String webhookPut = "webhooks.bookingEvent.put"; + vr.body(webhookPut, notNullValue()); + vr.body(webhookPut + ".summary", equalTo("Notifies that a booking has been created")); + vr.body(webhookPut + ".requestBody.content.'application/json'.schema.$ref", + equalTo("#/components/schemas/Booking")); + vr.body(webhookPut + ".responses.'204'.description", + equalTo("Indicates that the creation event was processed successfully")); + + String webhookDelete = "webhooks.bookingEvent.delete"; + vr.body(webhookPut, notNullValue()); + vr.body(webhookDelete + ".summary", equalTo("Notifies that a booking has been deleted")); + vr.body(webhookDelete + ".requestBody.content.'application/json'.schema.$ref", + equalTo("#/components/schemas/Booking")); + vr.body(webhookDelete + ".responses.'204'.description", + equalTo("Indicates that the deletion event was processed successfully")); + + } } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java index fd13c201..3d47f946 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java @@ -21,6 +21,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.collection.IsMapWithSize.aMapWithSize; @@ -123,5 +124,21 @@ public void testStaticDocument(String type) { vr.body(inventoryPathTrace + ".summary", equalTo("trace operation")); vr.body(inventoryPathTrace + ".operationId", equalTo("traceInventory")); vr.body(inventoryPathTrace + ".description", equalTo("tests the trace operation")); + + String webhookPut = "webhooks.bookingEvent.put"; + vr.body(webhookPut, notNullValue()); + vr.body(webhookPut + ".summary", equalTo("Notifies that a booking has been created")); + vr.body(webhookPut + ".requestBody.content.'application/json'.schema.$ref", + equalTo("#/components/schemas/Booking")); + vr.body(webhookPut + ".responses.'204'.description", + equalTo("Indicates that the creation event was processed successfully")); + + String webhookDelete = "webhooks.bookingEvent.delete"; + vr.body(webhookPut, notNullValue()); + vr.body(webhookDelete + ".summary", equalTo("Notifies that a booking has been deleted")); + vr.body(webhookDelete + ".requestBody.content.'application/json'.schema.$ref", + equalTo("#/components/schemas/Booking")); + vr.body(webhookDelete + ".responses.'204'.description", + equalTo("Indicates that the deletion event was processed successfully")); } } diff --git a/tck/src/main/resources/simpleapi.yaml b/tck/src/main/resources/simpleapi.yaml index bea1eb26..77086d95 100644 --- a/tck/src/main/resources/simpleapi.yaml +++ b/tck/src/main/resources/simpleapi.yaml @@ -120,6 +120,28 @@ paths: responses: '200': description: trace operation tested +webhooks: + bookingEvent: + put: + summary: Notifies that a booking has been created + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Booking' + responses: + '204': + description: Indicates that the creation event was processed successfully + delete: + summary: Notifies that a booking has been deleted + requestBody: + content: + 'application/json': + schema: + $ref: '#/components/schemas/Booking' + responses: + '204': + description: Indicates that the deletion event was processed successfully components: schemas: InventoryItem: From 397aaa714d0acaa8ff99eb2f69e9fcc43de7cfe5 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Tue, 14 May 2024 11:32:10 +0100 Subject: [PATCH 059/121] security schemes all allow scopes Co-authored-by: Andrew Rouse --- .../openapi/annotations/security/SecurityRequirement.java | 2 +- .../openapi/models/security/SecurityRequirement.java | 6 ++---- .../eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java index 62bd8f8e..e9fae9d8 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityRequirement.java @@ -49,7 +49,7 @@ * If the security scheme referred by the name property is of type "oauth2" or "openIdConnect", then the scopes * array is a list of scope names required for the execution. *

    - * For other security scheme types, the array MUST be empty. + * For other security scheme types, the array MAY contain a list of required roles. *

    * * @return a list of scope names required for the execution of this Security Requirement instance. diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java index d4d3a1b8..d3a1c481 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/security/SecurityRequirement.java @@ -37,8 +37,7 @@ public interface SecurityRequirement extends Constructible { * @param securitySchemeName * the name of security scheme declared in the Components section of the OpenAPI document * @param scope - * a required scope - only valid when the defined scheme's type is 'oauth2' or 'openIdConnect'. passing - * null will result in an empty list of scopes + * a required scope. passing null will result in an empty list of scopes * @return Updated SecurityRequirement instance */ SecurityRequirement addScheme(String securitySchemeName, String scope); @@ -50,8 +49,7 @@ public interface SecurityRequirement extends Constructible { * @param securitySchemeName * the name of security scheme declared in the Components section of the OpenAPI document * @param scopes - * the scopes required - only valid when the defined scheme is 'oauth2' or 'openIdConnect'. passing null - * will result in an empty list of scopes + * the scopes required. passing null will result in an empty list of scopes * @return Updated SecurityRequirement instance */ SecurityRequirement addScheme(String securitySchemeName, List scopes); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 32c99cce..801aad78 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -599,6 +599,7 @@ public void testSecurityScheme(String type) { String mutualTLS = "components.securitySchemes.mutualTLSScheme."; vr.body(mutualTLS + "type", equalTo("mutualTLS")); vr.body(mutualTLS + "description", equalTo("mutualTLS authentication needed to manage zepplins")); + vr.body(mutualTLS + "scopes", equalTo("zepplinScope")); } @Test(dataProvider = "formatProvider") From 9e9289fadd5080085952a6418216fcebbf2db972 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Tue, 14 May 2024 13:00:41 +0100 Subject: [PATCH 060/121] add test for scopes in more scurity schmes Co-authored-by: Andrew Rouse --- .../openapi/apps/airlines/resources/ZepplinResource.java | 2 +- .../eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 3 ++- .../microprofile/openapi/tck/ModelConstructionTest.java | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index 4bf737c7..d52e1fee 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -35,7 +35,7 @@ public class ZepplinResource { @APIResponse(responseCode = "404", description = "Review not found") @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") - @SecurityRequirement(name = "mutualTLSScheme") + @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") public Response deprecateZepplin() { return Response.ok().build(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 801aad78..c365187a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -549,6 +549,8 @@ public void testSecurityRequirement(String type) { allOf(aMapWithSize(2), hasEntry(equalTo("userApiKey"), empty()), hasEntry(equalTo("userBearerHttp"), empty())))); + + vr.body("paths.'/zepplins/{id}'.delete.security[0].mutualTLSScheme[0]", equalTo("zepplinScope")); } @Test(dataProvider = "formatProvider") @@ -599,7 +601,6 @@ public void testSecurityScheme(String type) { String mutualTLS = "components.securitySchemes.mutualTLSScheme."; vr.body(mutualTLS + "type", equalTo("mutualTLS")); vr.body(mutualTLS + "description", equalTo("mutualTLS authentication needed to manage zepplins")); - vr.body(mutualTLS + "scopes", equalTo("zepplinScope")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index dd736060..8cb80e5e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -1635,6 +1635,14 @@ public void securityRequirementTest() { final List schemeValue4 = Collections.emptyList(); assertEquals(sr.getScheme(schemeKey4), schemeValue4, "The value associated with the key: " + schemeKey4 + " is expected to be an empty list."); + + // Test a requirement with roles + final String schemeKey5 = "myScheme5"; + final List schemeValue5 = Arrays.asList("myRole1", "myRole2"); + sr.addScheme(schemeKey5, schemeValue5); + assertTrue(sr.hasScheme(schemeKey5), "Expected " + schemeKey5 + " to be present"); + assertEquals(sr.getScheme(schemeKey5), schemeValue5, + "The value associated with the key: " + schemeKey5 + " is expected to have two roles."); } @Test From aa7c2e1c2b3bfe58be0e09c5176cb067683fcdff Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 29 May 2024 11:38:36 +0100 Subject: [PATCH 061/121] Update Schema javadoc Json Schema links --- .../microprofile/openapi/models/media/Schema.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 9e95aa0b..10bcf4b7 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -29,12 +29,12 @@ /** * The Schema Object allows the definition of input and output data types. These types can be objects, but also - * primitives and arrays. This object is an extended subset of the - * JSON Schema Specification Wright Draft 00. + * primitives and arrays. This object is a superset of the + * JSON Schema Specification Draft 2020-12. *

    - * For more information about the properties, see JSON Schema Core and - * JSON Schema Validation. Unless - * stated otherwise, the property definitions follow the JSON Schema. + * For more information about the properties, see JSON + * Schema Core and JSON Schema + * Validation. Unless stated otherwise, the property definitions follow the JSON Schema. *

    * Any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing an * existing definition instead of defining the same Schema again. From cbf27af0a3e0907d6566f2346d4fa79766299209 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Wed, 15 May 2024 11:44:33 +0100 Subject: [PATCH 062/121] test for request body in operations that do not support request body --- .../airlines/resources/ZepplinResource.java | 29 ++++++++++++++++++- .../openapi/tck/AirlinesAppTest.java | 11 +++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index d52e1fee..7601a550 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -15,11 +15,15 @@ import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme; import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.HEAD; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Response; @@ -36,7 +40,30 @@ public class ZepplinResource { @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") - public Response deprecateZepplin() { + public Response deprecateZepplin(@RequestBody(description = "Something about a zepplin.", + content = @Content(mediaType = "application/json")) String string) { + return Response.ok().build(); + } + + @HEAD + @Path("{id}") + @APIResponse(responseCode = "200", description = "Review deleted") + @APIResponse(responseCode = "404", description = "Review not found") + @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") + @Produces("text/plain") + @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") + public Response headZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/requestBody") String string) { + return Response.ok().build(); + } + + @GET + @Path("{id}") + @APIResponse(responseCode = "200", description = "Review deleted") + @APIResponse(responseCode = "404", description = "Review not found") + @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") + @Produces("text/plain") + @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") + public Response getZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/requestBody") String string) { return Response.ok().build(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 514baa57..dd525850 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -290,6 +290,17 @@ public void testOperationUserResource(String type) { vr.body("paths.'/user/special'.post.parameters[0].schema", is(nullValue())); } + @Test(dataProvider = "formatProvider") + public void testOperationZepplinResource(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("paths.'/zepplins/{id}'.delete.requestBody.description", equalTo("Something about a zepplin.")); + vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); + vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); + + vr.body("paths.'/zepplins/{id}'.delete.requestBody.content", notNullValue()); + } + @Test(dataProvider = "formatProvider") public void testAPIResponse(String type) { ValidatableResponse vr = callEndpoint(type); From d1a6ea8d2fddf4e651649563bdec0d625ab2c135 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 30 May 2024 11:46:12 +0100 Subject: [PATCH 063/121] Test apps with no paths --- .../MyOASModelReaderForJustComponentApp.java | 47 +++++++++++++++++++ .../MyOASModelReaderForJustWebHookApp.java | 45 ++++++++++++++++++ .../ModelReaderAppWithJustComponentTest.java | 42 +++++++++++++++++ .../ModelReaderAppWithJustWebHookTest.java | 41 ++++++++++++++++ ...roprofile-reader-just-component.properties | 14 ++++++ ...icroprofile-reader-just-webhook.properties | 14 ++++++ 6 files changed, 203 insertions(+) create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustWebHookApp.java create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java create mode 100644 tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java create mode 100644 tck/src/main/resources/microprofile-reader-just-component.properties create mode 100644 tck/src/main/resources/microprofile-reader-just-webhook.properties diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java new file mode 100644 index 00000000..47a36311 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustComponentApp.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.reader; + +import java.util.HashMap; + +import org.eclipse.microprofile.openapi.OASFactory; +import org.eclipse.microprofile.openapi.OASModelReader; +import org.eclipse.microprofile.openapi.models.Components; +import org.eclipse.microprofile.openapi.models.OpenAPI; +import org.eclipse.microprofile.openapi.models.info.Contact; +import org.eclipse.microprofile.openapi.models.info.Info; +import org.eclipse.microprofile.openapi.models.media.Schema; + +public class MyOASModelReaderForJustComponentApp implements OASModelReader { + + @Override + public OpenAPI buildModel() { + return OASFactory.createObject(OpenAPI.class) + .info(OASFactory.createObject(Info.class) + .title("MarketApp API") + .version("1.0") + .termsOfService("http://example.com/terms") + .contact(OASFactory.createObject(Contact.class) + .name("market API Support") + .url("http://example.com/contact") + .email("admin@example.com"))) + .components(OASFactory.createObject(Components.class) + .schemas(new HashMap()) + .addSchema("id", OASFactory.createObject(Schema.class) + .addType(Schema.SchemaType.INTEGER) + .format("int32"))); + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustWebHookApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustWebHookApp.java new file mode 100644 index 00000000..cc473dcd --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderForJustWebHookApp.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.reader; + +import org.eclipse.microprofile.openapi.OASFactory; +import org.eclipse.microprofile.openapi.OASModelReader; +import org.eclipse.microprofile.openapi.models.OpenAPI; +import org.eclipse.microprofile.openapi.models.info.Contact; +import org.eclipse.microprofile.openapi.models.info.Info; + +public class MyOASModelReaderForJustWebHookApp implements OASModelReader { + + @Override + public OpenAPI buildModel() { + return OASFactory.createObject(OpenAPI.class) + .info(OASFactory.createObject(Info.class) + .title("MarketApp API") + .version("1.0") + .termsOfService("http://example.com/terms") + .contact(OASFactory.createObject(Contact.class) + .name("market API Support") + .url("http://example.com/contact") + .email("admin@example.com"))) + .addWebhook("MarketEvent", OASFactory.createPathItem() + .GET(OASFactory.createOperation() + .summary("Notifies that a deal has been done") + .responses(OASFactory.createAPIResponses() + .addAPIResponse("202", OASFactory.createAPIResponse() + .description( + "Indicates that the deal was processed successfully"))))); + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java new file mode 100644 index 00000000..f9e94924 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustComponentTest.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.eclipse.microprofile.openapi.tck; + +import static org.hamcrest.Matchers.equalTo; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.testng.annotations.Test; + +import io.restassured.response.ValidatableResponse; + +public class ModelReaderAppWithJustComponentTest extends AppTestBase { + @Deployment(name = "airlinesModelReader", testable = false) + public static WebArchive createDeployment() { + return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war") + .addPackages(true, "org.eclipse.microprofile.openapi.reader") + .addAsManifestResource("microprofile-reader-just-component.properties", + "microprofile-config.properties"); + } + + @Test(dataProvider = "formatProvider") + public void testDocumentCreated(String type) { + ValidatableResponse vr = callEndpoint(type); + vr.body("components.schemas.id.format", equalTo("int32")); + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java new file mode 100644 index 00000000..a6ffbae4 --- /dev/null +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppWithJustWebHookTest.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.eclipse.microprofile.openapi.tck; + +import static org.hamcrest.Matchers.equalTo; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.testng.annotations.Test; + +import io.restassured.response.ValidatableResponse; + +public class ModelReaderAppWithJustWebHookTest extends AppTestBase { + @Deployment(name = "airlinesModelReader", testable = false) + public static WebArchive createDeployment() { + return ShrinkWrap.create(WebArchive.class, "noPathsAppReader.war") + .addPackages(true, "org.eclipse.microprofile.openapi.reader") + .addAsManifestResource("microprofile-reader-just-webhook.properties", "microprofile-config.properties"); + } + + @Test(dataProvider = "formatProvider") + public void testDocumentCreated(String type) { + ValidatableResponse vr = callEndpoint(type); + vr.body("webhooks.MarketEvent.get.summary", equalTo("Notifies that a deal has been done")); + } +} diff --git a/tck/src/main/resources/microprofile-reader-just-component.properties b/tck/src/main/resources/microprofile-reader-just-component.properties new file mode 100644 index 00000000..fd002ba1 --- /dev/null +++ b/tck/src/main/resources/microprofile-reader-just-component.properties @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Contributors to the Eclipse Foundation +#

    +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#

    +# http://www.apache.org/licenses/LICENSE-2.0 +#

    +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustComponentApp \ No newline at end of file diff --git a/tck/src/main/resources/microprofile-reader-just-webhook.properties b/tck/src/main/resources/microprofile-reader-just-webhook.properties new file mode 100644 index 00000000..2b76a801 --- /dev/null +++ b/tck/src/main/resources/microprofile-reader-just-webhook.properties @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Contributors to the Eclipse Foundation +#

    +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#

    +# http://www.apache.org/licenses/LICENSE-2.0 +#

    +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +mp.openapi.model.reader=org.eclipse.microprofile.openapi.reader.MyOASModelReaderForJustWebHookApp \ No newline at end of file From b7f400af4bfae80808951d498ccbdbd0b983fb49 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Thu, 30 May 2024 13:17:33 +0100 Subject: [PATCH 064/121] move test for request body in operations that do not support request body to model reader test --- .../apps/airlines/resources/ZepplinResource.java | 9 +++------ .../openapi/reader/MyOASModelReaderImpl.java | 13 +++++++++++++ .../microprofile/openapi/tck/AirlinesAppTest.java | 11 ----------- .../openapi/tck/ModelReaderAppTest.java | 11 +++++++++++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index 7601a550..3a3dcb20 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -15,8 +15,6 @@ import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; -import org.eclipse.microprofile.openapi.annotations.media.Content; -import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme; @@ -40,8 +38,7 @@ public class ZepplinResource { @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") - public Response deprecateZepplin(@RequestBody(description = "Something about a zepplin.", - content = @Content(mediaType = "application/json")) String string) { + public Response deprecateZepplin(String string) { return Response.ok().build(); } @@ -52,7 +49,7 @@ public Response deprecateZepplin(@RequestBody(description = "Something about a z @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") - public Response headZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/requestBody") String string) { + public Response headZepplin() { return Response.ok().build(); } @@ -63,7 +60,7 @@ public Response headZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/ @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") - public Response getZepplin(@RequestBody(ref = "#/paths/~1zepplins~1{id}/delete/requestBody") String string) { + public Response getZepplin() { return Response.ok().build(); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 2ea56c3d..e886cfbe 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -280,6 +280,19 @@ public OpenAPI buildModel() { .description( "Indicates that the deletion event was processed successfully"))))) .paths(OASFactory.createObject(Paths.class) + .addPathItem("/zepplins/{id}", OASFactory.createObject(PathItem.class) + .HEAD(OASFactory.createObject(Operation.class) + .requestBody(OASFactory.createRequestBody() + .ref("#/paths/~1zepplins~1{id}/delete/requestBody"))) + .GET(OASFactory.createObject(Operation.class) + .requestBody(OASFactory.createRequestBody() + .ref("#/paths/~1zepplins~1{id}/delete/requestBody"))) + .DELETE(OASFactory.createObject(Operation.class) + .requestBody(OASFactory.createRequestBody() + .description("Something about a zepplin.") + .content(OASFactory.createObject(Content.class) + .addMediaType("mediaType", OASFactory + .createObject(MediaType.class)))))) .addPathItem("/modelReader/airlines", OASFactory.createObject(PathItem.class) .GET(OASFactory.createObject(Operation.class) .summary("Retrieve all available airlines") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index dd525850..514baa57 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -290,17 +290,6 @@ public void testOperationUserResource(String type) { vr.body("paths.'/user/special'.post.parameters[0].schema", is(nullValue())); } - @Test(dataProvider = "formatProvider") - public void testOperationZepplinResource(String type) { - ValidatableResponse vr = callEndpoint(type); - - vr.body("paths.'/zepplins/{id}'.delete.requestBody.description", equalTo("Something about a zepplin.")); - vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); - vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); - - vr.body("paths.'/zepplins/{id}'.delete.requestBody.content", notNullValue()); - } - @Test(dataProvider = "formatProvider") public void testAPIResponse(String type) { ValidatableResponse vr = callEndpoint(type); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index c3bc3d86..ac60bc1d 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -368,4 +368,15 @@ public void testWebhooks(String type) { equalTo("Indicates that the deletion event was processed successfully")); } + + @Test(dataProvider = "formatProvider") + public void testRequestBodyInOperations(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("paths.'/zepplins/{id}'.delete.requestBody.description", equalTo("Something about a zepplin.")); + vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); + vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); + + vr.body("paths.'/zepplins/{id}'.delete.requestBody.content", notNullValue()); + } } From 4feb8e67d743ae02b985c6e2004df4d5004c5d0a Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Wed, 29 May 2024 18:28:34 +0100 Subject: [PATCH 065/121] test paramater with object and space or pipe delimiters --- .../apps/airlines/resources/ZepplinResource.java | 11 +++++++++++ .../microprofile/openapi/tck/AirlinesAppTest.java | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index 3a3dcb20..f22bd54f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -14,7 +14,12 @@ package org.eclipse.microprofile.openapi.apps.airlines.resources; import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.openapi.annotations.enums.ParameterIn; +import org.eclipse.microprofile.openapi.annotations.enums.ParameterStyle; +import org.eclipse.microprofile.openapi.annotations.enums.SchemaType; import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme; @@ -49,6 +54,9 @@ public Response deprecateZepplin(String string) { @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") + @Parameter(name = "string", description = "something about a string", in = ParameterIn.QUERY, + required = true, + schema = @Schema(type = SchemaType.OBJECT), style = ParameterStyle.SPACEDELIMITED) public Response headZepplin() { return Response.ok().build(); } @@ -60,6 +68,9 @@ public Response headZepplin() { @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @Produces("text/plain") @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") + @Parameter(name = "string", description = "something about a string", in = ParameterIn.QUERY, + required = true, + schema = @Schema(type = SchemaType.OBJECT), style = ParameterStyle.PIPEDELIMITED) public Response getZepplin() { return Response.ok().build(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 514baa57..9781e1c3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -345,6 +345,21 @@ public void testParameter(String type) { testBookingIdMethods(vr); testReviewIdMethods(vr); testUserLoginMethods(vr); + testParameterWithObjectAndStyle(vr); + } + + private void testParameterWithObjectAndStyle(ValidatableResponse vr) { + String headParameters = "paths.'/zepplins/{id}'.head.parameters"; + String getParameters = "paths.'/zepplins/{id}'.get.parameters"; + + vr.body(headParameters, hasSize(1)); + vr.body(getParameters, hasSize(1)); + + vr.body(headParameters + "[0].schema.type", equalTo("object")); + vr.body(getParameters + "[0].schema.type", equalTo("object")); + + vr.body(headParameters + "[0].style", equalTo("spaceDelimited")); + vr.body(getParameters + "[0].style", equalTo("pipeDelimited")); } private void testUserLoginMethods(ValidatableResponse vr) { From 1999871337e4177953938b924798e5ad82f73949 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Tue, 4 Jun 2024 13:41:32 +0100 Subject: [PATCH 066/121] remove id from zepplin --- .../openapi/apps/airlines/resources/ZepplinResource.java | 3 --- .../microprofile/openapi/reader/MyOASModelReaderImpl.java | 6 +++--- .../eclipse/microprofile/openapi/tck/AirlinesAppTest.java | 6 +++--- .../microprofile/openapi/tck/ModelReaderAppTest.java | 8 ++++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index f22bd54f..8c1afc72 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -37,7 +37,6 @@ public class ZepplinResource { @DELETE - @Path("{id}") @APIResponse(responseCode = "200", description = "Review deleted") @APIResponse(responseCode = "404", description = "Review not found") @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @@ -48,7 +47,6 @@ public Response deprecateZepplin(String string) { } @HEAD - @Path("{id}") @APIResponse(responseCode = "200", description = "Review deleted") @APIResponse(responseCode = "404", description = "Review not found") @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") @@ -62,7 +60,6 @@ public Response headZepplin() { } @GET - @Path("{id}") @APIResponse(responseCode = "200", description = "Review deleted") @APIResponse(responseCode = "404", description = "Review not found") @Operation(summary = "Deprecate outdated airship technology", operationId = "deprecateZepplin") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index e886cfbe..1dd3facf 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -280,13 +280,13 @@ public OpenAPI buildModel() { .description( "Indicates that the deletion event was processed successfully"))))) .paths(OASFactory.createObject(Paths.class) - .addPathItem("/zepplins/{id}", OASFactory.createObject(PathItem.class) + .addPathItem("/zepplins", OASFactory.createObject(PathItem.class) .HEAD(OASFactory.createObject(Operation.class) .requestBody(OASFactory.createRequestBody() - .ref("#/paths/~1zepplins~1{id}/delete/requestBody"))) + .ref("#/paths/~1zepplins/delete/requestBody"))) .GET(OASFactory.createObject(Operation.class) .requestBody(OASFactory.createRequestBody() - .ref("#/paths/~1zepplins~1{id}/delete/requestBody"))) + .ref("#/paths/~1zepplins/delete/requestBody"))) .DELETE(OASFactory.createObject(Operation.class) .requestBody(OASFactory.createRequestBody() .description("Something about a zepplin.") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 9781e1c3..7b238eb3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -349,8 +349,8 @@ public void testParameter(String type) { } private void testParameterWithObjectAndStyle(ValidatableResponse vr) { - String headParameters = "paths.'/zepplins/{id}'.head.parameters"; - String getParameters = "paths.'/zepplins/{id}'.get.parameters"; + String headParameters = "paths.'/zepplins'.head.parameters"; + String getParameters = "paths.'/zepplins'.get.parameters"; vr.body(headParameters, hasSize(1)); vr.body(getParameters, hasSize(1)); @@ -565,7 +565,7 @@ public void testSecurityRequirement(String type) { hasEntry(equalTo("userApiKey"), empty()), hasEntry(equalTo("userBearerHttp"), empty())))); - vr.body("paths.'/zepplins/{id}'.delete.security[0].mutualTLSScheme[0]", equalTo("zepplinScope")); + vr.body("paths.'/zepplins'.delete.security[0].mutualTLSScheme[0]", equalTo("zepplinScope")); } @Test(dataProvider = "formatProvider") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index ac60bc1d..ec2dd42f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -373,10 +373,10 @@ public void testWebhooks(String type) { public void testRequestBodyInOperations(String type) { ValidatableResponse vr = callEndpoint(type); - vr.body("paths.'/zepplins/{id}'.delete.requestBody.description", equalTo("Something about a zepplin.")); - vr.body("paths.'/zepplins/{id}'.head.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); - vr.body("paths.'/zepplins/{id}'.get.requestBody.$ref", equalTo("#/paths/~1zepplins~1{id}/delete/requestBody")); + vr.body("paths.'/zepplins'.delete.requestBody.description", equalTo("Something about a zepplin.")); + vr.body("paths.'/zepplins'.head.requestBody.$ref", equalTo("#/paths/~1zepplins/delete/requestBody")); + vr.body("paths.'/zepplins'.get.requestBody.$ref", equalTo("#/paths/~1zepplins/delete/requestBody")); - vr.body("paths.'/zepplins/{id}'.delete.requestBody.content", notNullValue()); + vr.body("paths.'/zepplins'.delete.requestBody.content", notNullValue()); } } From bf6d085ab12bd33210aac3a84df2ff091b1083ac Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 15 May 2024 15:17:54 +0100 Subject: [PATCH 067/121] Allow ref with description and summary $ref is now allowed alongside description and summary. - Update model and annotation javadoc accordingly. - Test model - Test annotations --- .../annotations/callbacks/Callback.java | 3 +- .../openapi/annotations/headers/Header.java | 5 ++- .../openapi/annotations/links/Link.java | 5 ++- .../annotations/media/ExampleObject.java | 6 ++- .../annotations/parameters/Parameter.java | 5 ++- .../annotations/parameters/RequestBody.java | 5 ++- .../annotations/responses/APIResponse.java | 5 ++- .../annotations/security/SecurityScheme.java | 5 ++- .../openapi/annotations/tags/Tag.java | 5 ++- .../openapi/models/Reference.java | 7 ++-- .../openapi/apps/airlines/JAXRSApp.java | 41 ++++++++++++++---- .../openapi/reader/MyOASModelReaderImpl.java | 42 ++++++++++++++++++- .../openapi/tck/AirlinesAppTest.java | 31 ++++++++++++++ .../openapi/tck/ModelReaderAppTest.java | 31 ++++++++++++++ 14 files changed, 167 insertions(+), 29 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java index 46a3bb2b..94d3b526 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java @@ -70,7 +70,8 @@ * Reference value to a Callback object. *

    * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * mutually exclusive. If other properties are defined in addition to the {@code ref} property then the result is + * undefined. * * @return reference to a callback object definition **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java index e14a5e8f..ce4387c0 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/headers/Header.java @@ -85,8 +85,9 @@ /** * Reference value to a Header object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a header **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java index b46fef51..23db474c 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java @@ -96,8 +96,9 @@ /** * Reference value to a Link object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a link **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java index 1dd530ed..7b69c3fd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java @@ -85,8 +85,10 @@ /** * Reference value to an Example object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} and {@link #summary()} but is mutually exclusive with all other properties. If properties + * other than {@code description} and {@code summary} are defined in addition to the {@code ref} property then the + * result is undefined. * * @return reference to an example **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java index 634e0af5..7edaa596 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameter.java @@ -200,8 +200,9 @@ /** * Reference value to a Parameter object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a parameter **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java index 0f07d832..bacde139 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java @@ -74,8 +74,9 @@ /** * Reference value to a RequestBody object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a request body **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java index 87cbb817..cce59f7f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java @@ -128,8 +128,9 @@ /** * Reference value to a Response object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a response **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java index 5155f134..4990678f 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/security/SecurityScheme.java @@ -132,8 +132,9 @@ /** * Reference value to a SecurityScheme object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a security scheme **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java index 34f8fcee..602fdc2d 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/tags/Tag.java @@ -101,8 +101,9 @@ /** * Reference value to a Tag object. *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the ref property then the result is undefined. + * This property provides a reference to an object defined elsewhere. This property may be used with + * {@link #description()} but is mutually exclusive with all other properties. If properties other than + * {@code description} are defined in addition to the {@code ref} property then the result is undefined. * * @return reference to a tag **/ diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Reference.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Reference.java index 3639a3b4..0226781e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Reference.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Reference.java @@ -53,9 +53,10 @@ public interface Reference> { * response.setRef("NotFound"); // #/components/responses/NotFound * *

    - * This property provides a reference to an object defined elsewhere. This property and all other properties are - * mutually exclusive. If other properties are defined in addition to the reference property then the result is - * undefined. + * This property provides a reference to an object defined elsewhere. This property may be used alongside + * {@code description} and {@code summary} if they exist on the object, but is mutually exclusive with all other + * properties. If properties other than {@code description} and {@code summary} are defined in addition to the + * reference property then the result is undefined. * * @param ref * a reference to a T object in the components section of this OpenAPI document or a JSON pointer to diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index 50d6aae1..e9cc8a2d 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -137,7 +137,10 @@ @APIResponse(name = "FoundBookings", responseCode = "200", description = "Bookings retrieved", content = @Content(schema = @Schema(type = SchemaType.ARRAY, - implementation = Booking.class))) + implementation = Booking.class))), + @APIResponse(name = "FoundBookingsARef", + ref = "#/components/responses/FoundBookings", + description = "Found Bookings Reference") }, parameters = { @Parameter(name = "departureDate", in = ParameterIn.QUERY, @@ -147,7 +150,10 @@ @Parameter(name = "username", in = ParameterIn.QUERY, description = "The name that needs to be deleted", schema = @Schema(type = SchemaType.STRING), - required = true) + required = true), + @Parameter(name = "usernameARef", + ref = "#/components/parameters/username", + description = "username reference") }, examples = { @ExampleObject(name = "review", summary = "External review example", @@ -156,13 +162,21 @@ extensions = @Extension(name = "x-example-object", value = "test-example-object")), @ExampleObject(name = "user", summary = "External user example", - externalValue = "http://foo.bar/examples/user-example.json") + externalValue = "http://foo.bar/examples/user-example.json"), + @ExampleObject(name = "userARef", + ref = "#/components/examples/user", + description = "User reference", + summary = "Referenced example") }, requestBodies = { @RequestBody(name = "review", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Review.class)), - required = true, description = "example review to add") + required = true, + description = "example review to add"), + @RequestBody(name = "reviewARef", + ref = "#/components/requestBodies/review", + description = "Review reference") }, headers = { @Header(name = "Max-Rate", description = "Maximum rate", @@ -173,20 +187,29 @@ value = "test-header")), @Header(name = "Request-Limit", description = "The number of allowed requests in the current period", - schema = @Schema(type = SchemaType.INTEGER)) + schema = @Schema(type = SchemaType.INTEGER)), + @Header(name = "Request-Limit-ARef", + ref = "#/components/headers/Request-Limit", + description = "Request-Limit reference") }, securitySchemes = { @SecurityScheme(securitySchemeName = "httpTestScheme", description = "user security scheme", type = SecuritySchemeType.HTTP, - scheme = "testScheme") + scheme = "testScheme"), + @SecurityScheme(securitySchemeName = "httpTestSchemeARef", + ref = "#/components/securitySchemes/httpTestScheme", + description = "httpTestScheme reference") }, links = { @Link(name = "UserName", description = "The username corresponding to provided user id", operationId = "getUserByName", parameters = @LinkParameter(name = "userId", - expression = "$request.path.id")) + expression = "$request.path.id")), + @Link(name = "UserNameARef", + ref = "#/components/links/UserName", + description = "UserName reference") }, callbacks = { @Callback(name = "GetBookings", @@ -194,7 +217,9 @@ operations = @CallbackOperation(summary = "Retrieve all bookings for current user", responses = { @APIResponse(ref = "FoundBookings") - })) + })), + @Callback(name = "GetBookingsARef", + ref = "#/components/callbacks/GetBookings") }, extensions = @Extension(name = "x-components", value = "test-components")), extensions = @Extension(name = "x-openapi-definition", value = "test-openapi-definition")) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 45ce98a3..8f0ed769 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -105,6 +105,8 @@ public OpenAPI buildModel() { .title("Airlines")) .addSchema("AirlinesRef", OASFactory.createObject(Schema.class) .ref("#/components/schemas/Airlines")) + .addSchema("Flight", OASFactory.createSchema() + .addType(Schema.SchemaType.OBJECT)) .addSchema("id", OASFactory.createObject(Schema.class) .addType(Schema.SchemaType.INTEGER) .format("int32")) @@ -176,6 +178,9 @@ public OpenAPI buildModel() { .schema(OASFactory.createObject(Schema.class) .addType(Schema.SchemaType.ARRAY) .ref("#/components.schemas.Booking"))))) + .addResponse("FoundBookingsRef", OASFactory.createAPIResponse() + .ref("#/components/responses/FoundBookings") + .description("Found Bookings Reference")) .parameters(new HashMap()) .addParameter("departureDate", OASFactory.createObject(Parameter.class) .required(true) @@ -185,6 +190,9 @@ public OpenAPI buildModel() { .required(true) .description("The name that needs to be deleted") .schema(OASFactory.createObject(Schema.class))) + .addParameter("usernameRef", OASFactory.createParameter() + .ref("#/components/parameters/username") + .description("username reference")) .examples(new HashMap()) .addExample("review", OASFactory.createObject(Example.class) .summary("External review example") @@ -193,6 +201,10 @@ public OpenAPI buildModel() { .addExample("user", OASFactory.createObject(Example.class) .summary("External user example") .externalValue("http://foo.bar/examples/user-example.json")) + .addExample("userRef", OASFactory.createExample() + .ref("#/componets/examples/user") + .summary("Referenced example") + .description("User reference")) .requestBodies(new HashMap()) .addRequestBody("review", OASFactory.createObject(RequestBody.class) .required(true) @@ -201,6 +213,9 @@ public OpenAPI buildModel() { .addMediaType("application/json", OASFactory.createObject(MediaType.class) .schema(OASFactory.createObject(Schema.class) .ref("#/components.schemas.Review"))))) + .addRequestBody("reviewRef", OASFactory.createRequestBody() + .ref("#/components/requestBodies/review") + .description("Review reference")) .headers(new HashMap()) .addHeader("Max-Rate", OASFactory.createObject(Header.class) .description("Maximum rate") @@ -213,17 +228,42 @@ public OpenAPI buildModel() { .description("The number of allowed requests in the current period") .schema(OASFactory.createObject(Schema.class) .addType(Schema.SchemaType.INTEGER))) + .addHeader("Request-Limit-Ref", OASFactory.createHeader() + .ref("#/components/headers/Request-Limit") + .description("Request-Limit reference")) .securitySchemes(new HashMap()) .addSecurityScheme("httpTestScheme", OASFactory.createObject(SecurityScheme.class) .description("user security scheme") .type(SecurityScheme.Type.HTTP) .scheme("testScheme")) + .addSecurityScheme("httpTestSchemeRef", OASFactory.createSecurityScheme() + .ref("#/components/securitySchemes/httpTestScheme") + .description("httpTestScheme reference")) .links(new HashMap()) .addLink("UserName", OASFactory.createObject(Link.class) .description("The username corresponding to provided user id") .operationId("getUserByName") .parameters(new HashMap()) - .addParameter("userId", "$request.link-path.userId"))) + .addParameter("userId", "$request.link-path.userId")) + .addLink("UserNameRef", OASFactory.createLink() + .ref("#/components/links/UserName") + .description("UserName reference")) + .callbacks(new HashMap<>()) + .addCallback("availabilityCallback", OASFactory.createCallback() + .addPathItem("http://localhost:9080/oas3-airlines/availability", OASFactory + .createPathItem() + .GET(OASFactory.createOperation() + .summary("Retrieve available flights") + .responses(OASFactory.createAPIResponses() + .addAPIResponse("200", OASFactory.createAPIResponse() + .description("successful operation") + .content(OASFactory.createContent() + .addMediaType("application/json", OASFactory + .createMediaType() + .schema(OASFactory.createSchema() + .ref("#/components/schemas/Flight"))))))))) + .addCallback("availabilityCallbackRef", OASFactory.createCallback() + .ref("#/components/callbacks/availabilityCallback"))) .tags(new ArrayList()) .addTag(OASFactory.createObject(Tag.class) .name("Get Airlines") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index b83d3bb2..e2e4b934 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -1128,4 +1128,35 @@ public void testOpenAPIDefinitionExtension(String type) { vr.body("x-openapi-definition", equalTo("test-openapi-definition")); } + @Test(dataProvider = "formatProvider") + public void testRef(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("components.responses.FoundBookingsARef.$ref", equalTo("#/components/responses/FoundBookings")); + vr.body("components.responses.FoundBookingsARef.description", equalTo("Found Bookings Reference")); + + vr.body("components.parameters.usernameARef.$ref", equalTo("#/components/parameters/username")); + vr.body("components.parameters.usernameARef.description", equalTo("username reference")); + + vr.body("components.examples.userARef.$ref", equalTo("#/components/examples/user")); + vr.body("components.examples.userARef.description", equalTo("User reference")); + vr.body("components.examples.userARef.summary", equalTo("Referenced example")); + + vr.body("components.requestBodies.reviewARef.$ref", equalTo("#/components/requestBodies/review")); + vr.body("components.requestBodies.reviewARef.description", equalTo("Review reference")); + + vr.body("components.headers.Request-Limit-ARef.$ref", equalTo("#/components/headers/Request-Limit")); + vr.body("components.headers.Request-Limit-ARef.description", equalTo("Request-Limit reference")); + + vr.body("components.securitySchemes.httpTestSchemeARef.$ref", + equalTo("#/components/securitySchemes/httpTestScheme")); + vr.body("components.securitySchemes.httpTestSchemeARef.description", equalTo("httpTestScheme reference")); + + vr.body("components.links.UserNameARef.$ref", equalTo("#/components/links/UserName")); + vr.body("components.links.UserNameARef.description", equalTo("UserName reference")); + + vr.body("components.callbacks.GetBookingsARef.$ref", + equalTo("#/components/callbacks/GetBookings")); + } + } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index ae928428..f7284acb 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -327,6 +327,37 @@ public void testComponents(String type) { vr.body("components.links.UserName", notNullValue()); } + @Test(dataProvider = "formatProvider") + public void testReferences(String type) { + ValidatableResponse vr = callEndpoint(type); + + vr.body("components.responses.FoundBookingsRef.$ref", equalTo("#/components/responses/FoundBookings")); + vr.body("components.responses.FoundBookingsRef.description", equalTo("Found Bookings Reference")); + + vr.body("components.parameters.usernameRef.$ref", equalTo("#/components/parameters/username")); + vr.body("components.parameters.usernameRef.description", equalTo("username reference")); + + vr.body("components.examples.userRef.$ref", equalTo("#/componets/examples/user")); + vr.body("components.examples.userRef.description", equalTo("User reference")); + vr.body("components.examples.userRef.summary", equalTo("Referenced example")); + + vr.body("components.requestBodies.reviewRef.$ref", equalTo("#/components/requestBodies/review")); + vr.body("components.requestBodies.reviewRef.description", equalTo("Review reference")); + + vr.body("components.headers.Request-Limit-Ref.$ref", equalTo("#/components/headers/Request-Limit")); + vr.body("components.headers.Request-Limit-Ref.description", equalTo("Request-Limit reference")); + + vr.body("components.securitySchemes.httpTestSchemeRef.$ref", + equalTo("#/components/securitySchemes/httpTestScheme")); + vr.body("components.securitySchemes.httpTestSchemeRef.description", equalTo("httpTestScheme reference")); + + vr.body("components.links.UserNameRef.$ref", equalTo("#/components/links/UserName")); + vr.body("components.links.UserNameRef.description", equalTo("UserName reference")); + + vr.body("components.callbacks.availabilityCallbackRef.$ref", + equalTo("#/components/callbacks/availabilityCallback")); + } + @Test(dataProvider = "formatProvider") public void testHeaderInComponents(String type) { ValidatableResponse vr = callEndpoint(type); From 8f3ec8798abb42b3b5353ccdeb3f33bb12ead789 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 29 May 2024 15:48:15 +0100 Subject: [PATCH 068/121] Make request body required by default When scanning classes and annotations, default to the request body being required for operations which have a request body. --- .../annotations/parameters/RequestBody.java | 6 ++++- .../annotations/parameters/package-info.java | 2 +- .../openapi/apps/airlines/JAXRSApp.java | 11 ++++++++- .../apps/airlines/resources/UserResource.java | 6 ++--- .../apps/petstore/resource/PetResource.java | 3 +-- .../petstore/resource/PetStoreResource.java | 2 +- .../apps/petstore/resource/UserResource.java | 5 ++-- .../openapi/tck/AirlinesAppTest.java | 23 +++++++++++++++++++ 8 files changed, 46 insertions(+), 12 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java index bacde139..3b61fd38 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java @@ -56,10 +56,14 @@ /** * Determines if the request body is required in the request. + *

    + * Note that the default value of this property is {@code true}, while the default value of the {@code required} + * property in the OpenAPI specification is {@code false}, because Jakarta REST resource methods which accept a + * request body generally require it. * * @return whether or not this requestBody is required **/ - boolean required() default false; + boolean required() default true; /** * The unique name to identify this request body. Unless this annotation is used on the actual request body diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/package-info.java index 633bda27..e59e772b 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/package-info.java @@ -32,6 +32,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.2") +@org.osgi.annotation.versioning.Version("1.2.1") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.annotations.parameters; \ No newline at end of file diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index e9cc8a2d..6ab78821 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -172,8 +172,17 @@ @RequestBody(name = "review", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Review.class)), - required = true, description = "example review to add"), + @RequestBody(name = "nonRequiredReview", + content = @Content(mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(implementation = Review.class)), + required = false, + description = "example non-required review"), + @RequestBody(name = "requiredReview", + content = @Content(mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(implementation = Review.class)), + required = true, + description = "example required review"), @RequestBody(name = "reviewARef", ref = "#/components/requestBodies/review", description = "Review reference") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/UserResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/UserResource.java index d6ba7682..726d5f05 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/UserResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/UserResource.java @@ -148,7 +148,7 @@ public Response createUser( /* tags = {"user"}, //this operation intentionally doesn't have tags attribute, since above Tag ref should apply */ ) public Response createUsersWithArrayInput( - @RequestBody(description = "Array of user object", required = true, + @RequestBody(description = "Array of user object", content = @Content(mediaType = "application/json", schema = @Schema(type = SchemaType.ARRAY, implementation = User.class, nullable = true, writeOnly = true, minItems = 2, @@ -168,7 +168,7 @@ public Response createUsersWithArrayInput( @Operation(summary = "Creates list of users with given input list", // List of User objects operationId = "createUsersFromList") public Response createUsersWithListInput( - @RequestBody(description = "List of user object", required = true) java.util.List users) { + @RequestBody(description = "List of user object") java.util.List users) { for (User user : users) { userData.addUser(user); } @@ -177,7 +177,7 @@ public Response createUsersWithListInput( @Path("/username/{username}") @PUT - @RequestBody(name = "user", description = "Record of a new user to be created in the system.", + @RequestBody(name = "user", description = "Record of a new user to be created in the system.", required = false, content = @Content(mediaType = "application/json", schema = @Schema(implementation = User.class), examples = @ExampleObject(name = "user", summary = "Example user properties to update", diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java index 9d74f262..cfae2c91 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetResource.java @@ -172,7 +172,7 @@ public Response deletePet( @RequestBody(name = "pet", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class), examples = @ExampleObject(ref = "http://example.org/petapi-examples/openapi.json#/components/examples/pet-example")), - required = true, description = "example of a new pet to add") + description = "example of a new pet to add") @Operation(summary = "Add pet to store", description = "Add a new pet to the store") public Response addPet(Pet pet) { Pet updatedPet = petData.addPet(pet); @@ -193,7 +193,6 @@ public Response addPet(Pet pet) { @Operation(summary = "Update an existing pet", description = "Update an existing pet with the given new attributes") public Response updatePet( @RequestBody(description = "Attribute to update existing pet record", - required = true, content = @Content(schema = @Schema(implementation = Pet.class))) Pet pet) { Pet updatedPet = petData.addPet(pet); return Response.ok().entity(updatedPet).build(); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java index a4a9426c..1dc91525 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/PetStoreResource.java @@ -115,7 +115,7 @@ public Response getOrderById( @APIResponse(responseCode = "200", description = "successful operation") @APIResponse(responseCode = "400", description = "Invalid Order") public Order placeOrder( - @RequestBody(description = "order placed for purchasing the pet", required = true) Order order) { + @RequestBody(description = "order placed for purchasing the pet") Order order) { storeData.placeOrder(order); return storeData.placeOrder(order); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java index be994b3a..15a672c4 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/resource/UserResource.java @@ -69,8 +69,7 @@ public class UserResource { }) public Response createUser( @RequestBody(description = "Created user object", - content = @Content(schema = @Schema(ref = "#/components/schemas/User")), - required = true) User user) { + content = @Content(schema = @Schema(ref = "#/components/schemas/User"))) User user) { userData.addUser(user); return Response.ok().entity("").build(); } @@ -112,7 +111,7 @@ public Response updateUser( @Parameter(name = "username", description = "name that need to be deleted", schema = @Schema(type = SchemaType.STRING), required = true) @PathParam("username") String username, - @RequestBody(description = "Updated user object", required = true) User user) { + @RequestBody(description = "Updated user object") User user) { userData.addUser(user); return Response.ok().entity("").build(); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index d9973b4c..31fc29a5 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -487,9 +487,16 @@ public void testRequestBodyAnnotations(String type) { vr.body(endpoint + ".description", equalTo("Create a new booking with the provided information.")); vr.body(endpoint + ".content", notNullValue()); vr.body(endpoint + ".x-request-body", equalTo("test-request-body")); + vr.body(endpoint + ".required", equalTo(true)); + // PUT method with entity parameter but no @RequestBody annotation endpoint = "paths.'/bookings/{id}'.put.requestBody"; vr.body(endpoint + ".content", notNullValue()); + vr.body(endpoint + ".required", equalTo(true)); + + // GET method without @RequestBody annotation + endpoint = "paths.'/bookings/{id}'.get.requestBody"; + vr.body(endpoint, nullValue()); endpoint = "paths.'/user'.post.requestBody"; vr.body(endpoint + ".description", equalTo("Record of a new user to be created in the system.")); @@ -499,6 +506,7 @@ public void testRequestBodyAnnotations(String type) { endpoint = "paths.'/user/username/{username}'.put.requestBody"; vr.body(endpoint + ".description", equalTo("Record of a new user to be created in the system.")); vr.body(endpoint + ".content", notNullValue()); + vr.body(endpoint + ".required", either(nullValue()).or(equalTo(false))); endpoint = "paths.'/user/createWithArray'.post.requestBody"; vr.body(endpoint + ".description", equalTo("Array of user object")); @@ -509,6 +517,21 @@ public void testRequestBodyAnnotations(String type) { vr.body(endpoint + ".description", equalTo("List of user object")); vr.body(endpoint + ".content", notNullValue()); vr.body(endpoint + ".required", equalTo(true)); + + endpoint = "components.requestBodies.review"; + vr.body(endpoint + ".description", equalTo("example review to add")); + vr.body(endpoint + ".content", notNullValue()); + vr.body(endpoint + ".required", equalTo(true)); + + endpoint = "components.requestBodies.nonRequiredReview"; + vr.body(endpoint + ".description", equalTo("example non-required review")); + vr.body(endpoint + ".content", notNullValue()); + vr.body(endpoint + ".required", either(nullValue()).or(equalTo(false))); + + endpoint = "components.requestBodies.requiredReview"; + vr.body(endpoint + ".description", equalTo("example required review")); + vr.body(endpoint + ".content", notNullValue()); + vr.body(endpoint + ".required", equalTo(true)); } @Test(dataProvider = "formatProvider") From 350d6c117a73167654a832b7af5828fd6bc3d51a Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 24 May 2024 16:36:07 +0100 Subject: [PATCH 069/121] Add PathItems to Components - update model interfaces - update ModelConstructionTest - update OASModelReader and static file tests --- .../openapi/models/Components.java | 49 +++++++++++++++++++ .../openapi/reader/MyOASModelReaderImpl.java | 14 +++++- .../openapi/tck/ModelConstructionTest.java | 48 ++++++++++++------ .../openapi/tck/ModelReaderAppTest.java | 17 +++++++ .../openapi/tck/StaticDocumentTest.java | 9 ++++ tck/src/main/resources/simpleapi.yaml | 21 ++++++++ 6 files changed, 143 insertions(+), 15 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java index 174af0d4..6f8ab497 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java @@ -483,4 +483,53 @@ default Components callbacks(Map callbacks) { */ void removeCallback(String key); + /** + * Returns the pathItems property of this Components instance. Path items listed here can be referenced from + * elsewhere in the OpenAPI document. + * + * @return a copy Map (potentially immutable) of path items + */ + Map getPathItems(); + + /** + * Sets the pathItems property of this Components instance. Path items listed here can be referenced from elsewhere + * in the OpenAPI document. + * + * @param pathItems + * a map of path items + */ + void setPathItems(Map pathItems); + + /** + * Sets the pathItems property of this Components instance. Path items listed here can be referenced from elsewhere + * in the OpenAPI document. + * + * @param pathItems + * a map of path items + * @return the current Schema instance + */ + default Components pathItems(Map pathItems) { + setPathItems(pathItems); + return this; + } + + /** + * Adds a path item. + * + * @param name + * name of the path item to add + * @param pathItem + * the path item to add + * @return the current Schema instance + */ + Components addPathItem(String name, PathItem pathItem); + + /** + * Removes a path item. + * + * @param name + * name of the path item to remove + */ + void removePathItem(String name); + } \ No newline at end of file diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 4036fb14..4b1a745e 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -264,7 +264,19 @@ public OpenAPI buildModel() { .schema(OASFactory.createSchema() .ref("#/components/schemas/Flight"))))))))) .addCallback("availabilityCallbackRef", OASFactory.createCallback() - .ref("#/components/callbacks/availabilityCallback"))) + .ref("#/components/callbacks/availabilityCallback")) + .pathItems(new HashMap<>()) + .addPathItem("idCrud", OASFactory.createPathItem() + .DELETE(OASFactory.createOperation() + .responses(OASFactory.createAPIResponses() + .addAPIResponse("202", OASFactory.createAPIResponse() + .content(OASFactory.createContent()) + .description("Delete item")))) + .addParameter(OASFactory.createParameter() + .name("id") + .in(In.PATH) + .description("The item parameter") + .required(true)))) .tags(new ArrayList()) .addTag(OASFactory.createObject(Tag.class) .name("Get Airlines") diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index f62faa42..ae674fe9 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -393,6 +393,27 @@ public void componentsTest() { SecurityScheme otherSecuritySchemeValue = createConstructibleInstance(SecurityScheme.class); checkMapImmutable(c, Components::getSecuritySchemes, "otherSecurityScheme", otherSecuritySchemeValue); checkNullValueInAdd(c::getSecuritySchemes, c::addSecurityScheme, "someSecurityScheme", securitySchemeValue); + + final String pathItemKey = "myPathItem"; + final PathItem pathItemValue = createConstructibleInstance(PathItem.class); + checkSameObject(c, c.addPathItem(pathItemKey, pathItemValue)); + checkMapEntry(c.getPathItems(), pathItemKey, pathItemValue); + assertEquals(c.getPathItems().size(), 1, "The map is expected to contain one entry."); + c.removePathItem(pathItemKey); + assertEquals(c.getPathItems().size(), 0, "The map is expected to be empty."); + + final String pathItemKey2 = "myPathItem2"; + final PathItem pathItemValue2 = createConstructibleInstance(PathItem.class); + c.setPathItems(Collections.singletonMap(pathItemKey2, pathItemValue2)); + checkMapEntry(c.getPathItems(), pathItemKey2, pathItemValue2); + assertEquals(c.getPathItems().size(), 1, "The map is expected to contain one entry."); + checkSameObject(c, c.addPathItem(pathItemKey, pathItemValue)); + checkMapEntry(c.getPathItems(), pathItemKey, pathItemValue); + assertEquals(c.getPathItems().size(), 2, "The map is expected to contain two entries."); + + PathItem otherPathItemValue = createConstructibleInstance(PathItem.class); + checkMapImmutable(c, Components::getPathItems, "otherPathItem", otherPathItemValue); + checkNullValueInAdd(c::getPathItems, c::addPathItem, "somePathItem", pathItemValue); } @Test @@ -1779,14 +1800,14 @@ private void processReference(Reference r) { r.setRef(myRef1); assertEquals(r.getRef(), myRef1, "The return value of getRef() is expected to be equal to the value that was set."); + // Check that the short name ref value can be set using the setter method and that the getter method returns the // expanded value. - if (!(r instanceof PathItem)) { - final String shortName = "myRef2"; - final String myRef2 = createReference(r, shortName); - r.setRef(shortName); - assertEquals(r.getRef(), myRef2, "The return value of getRef() is expected to be a fully expanded name."); - } + final String shortName2 = "myRef2"; + final String myRef2 = createReference(r, shortName2); + r.setRef(shortName2); + assertEquals(r.getRef(), myRef2, "The return value of getRef() is expected to be a fully expanded name."); + // Check that the ref value can be set using the builder method and that the getter method returns the same // value. final String myRef3 = createReference(r, "myRef3"); @@ -1794,15 +1815,14 @@ private void processReference(Reference r) { assertSame(self, r, "The return value of ref() is expected to return the current instance."); assertEquals(r.getRef(), myRef3, "The return value of getRef() is expected to be equal to the value that was set."); + // Check that the short name ref value can be set using the builder method and that the getter method returns // the expanded value. - if (!(r instanceof PathItem)) { - final String shortName = "myRef4"; - final String myRef4 = createReference(r, shortName); - final Reference self2 = r.ref(shortName); - assertSame(self2, r, "The return value of ref() is expected to return the current instance."); - assertEquals(r.getRef(), myRef4, "The return value of getRef() is expected to be a fully expanded name."); - } + final String shortName4 = "myRef4"; + final String myRef4 = createReference(r, shortName4); + final Reference self2 = r.ref(shortName4); + assertSame(self2, r, "The return value of ref() is expected to return the current instance."); + assertEquals(r.getRef(), myRef4, "The return value of getRef() is expected to be a fully expanded name."); } private void processConstructibleProperty(Constructible o, Property p, Class enclosingInterface) { @@ -1896,7 +1916,7 @@ private String createReference(Reference r, String v) { } else if (r instanceof Parameter) { sb.append("#/components/parameters/"); } else if (r instanceof PathItem) { - sb.append("http://www.abc.def.ghi/"); + sb.append("#/components/pathItems/"); } else if (r instanceof RequestBody) { sb.append("#/components/requestBodies/"); } else if (r instanceof Schema) { diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java index a265b850..300ca235 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelReaderAppTest.java @@ -325,6 +325,7 @@ public void testComponents(String type) { vr.body("components.headers.Request-Limit", notNullValue()); vr.body("components.securitySchemes.httpTestScheme", notNullValue()); vr.body("components.links.UserName", notNullValue()); + vr.body("components.pathItems.idCrud", notNullValue()); } @Test(dataProvider = "formatProvider") @@ -368,6 +369,22 @@ public void testHeaderInComponents(String type) { vr.body(maxRate + ".allowEmptyValue", equalTo(true)); } + @Test(dataProvider = "formatProvider") + public void testPathItemWithRef(String type) { + ValidatableResponse vr = callEndpoint(type); + + // Referencing path item + String refpath = "paths.'/refpath/{id}'"; + vr.body(refpath + ".$ref", equalTo("#/components/pathItems/idCrud")); + vr.body(refpath + ".get.responses.'200'", notNullValue()); + + // Referenced path item + String idCrud = "components.pathItems.idCrud"; + vr.body(idCrud, notNullValue()); + vr.body(idCrud + ".parameters[0].description", equalTo("The item parameter")); + vr.body(idCrud + ".delete.responses.'202'.description", equalTo("Delete item")); + } + @Test(dataProvider = "formatProvider") public void testContentInAPIResponse(String type) { ValidatableResponse vr = callEndpoint(type); diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java index 3d47f946..350160bf 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/StaticDocumentTest.java @@ -140,5 +140,14 @@ public void testStaticDocument(String type) { equalTo("#/components/schemas/Booking")); vr.body(webhookDelete + ".responses.'204'.description", equalTo("Indicates that the deletion event was processed successfully")); + + String idCrud = "components.pathItems.idCrud"; + vr.body(idCrud, notNullValue()); + vr.body(idCrud + ".parameters[0].description", equalTo("The item parameter")); + vr.body(idCrud + ".delete.responses.'202'.description", equalTo("Delete item")); + + String refpath = "paths.'/refpath/{id}'"; + vr.body(refpath + ".$ref", equalTo("#/components/pathItems/idCrud")); + vr.body(refpath + ".get.responses.'200'", notNullValue()); } } diff --git a/tck/src/main/resources/simpleapi.yaml b/tck/src/main/resources/simpleapi.yaml index 77086d95..b38c11d3 100644 --- a/tck/src/main/resources/simpleapi.yaml +++ b/tck/src/main/resources/simpleapi.yaml @@ -120,6 +120,15 @@ paths: responses: '200': description: trace operation tested + /refpath/{id}: + $ref: '#/components/pathItems/idCrud' + get: + responses: + '200': + content: + 'application/json': + schema: + $ref: '#/components/schemas/InventoryItem' webhooks: bookingEvent: put: @@ -186,3 +195,15 @@ components: examples: - 408-867-5309 type: object + pathItems: + idCrud: + delete: + responses: + '202': + content: [] + description: Delete item + parameters: + - name: id + in: path + description: The item parameter + required: true From 09270cc1738c3b7773dbcd11a6f28fe889e0569a Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 6 Jun 2024 10:57:42 +0100 Subject: [PATCH 070/121] Re-add change to model reader test lost in merge --- .../openapi/reader/MyOASModelReaderImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java index 2087ed21..e94c0a7a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/reader/MyOASModelReaderImpl.java @@ -455,6 +455,16 @@ public OpenAPI buildModel() { .title("id") .description("id of the new booking") .addType( - Schema.SchemaType.STRING))))))))); + Schema.SchemaType.STRING)))))))) + .addPathItem("/refpath/{id}", OASFactory.createPathItem() + .ref("idCrud") // Note PathItem allows ref with other properties + .GET(OASFactory.createOperation() + .responses(OASFactory.createAPIResponses() + .addAPIResponse("200", OASFactory.createAPIResponse() + .content(OASFactory.createContent() + .addMediaType("application/json", + OASFactory.createMediaType() + .schema(OASFactory.createSchema() + .ref("Airlines"))))))))); } } From 96366ebe8f0489747fa7ac7ca1a52b1627f33a66 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 5 Jun 2024 15:28:49 +0100 Subject: [PATCH 071/121] PathItem and PathItemOperation annotations Allows PathItems to be defined under Components. Allows webhooks to be defined. --- .../openapi/annotations/Components.java | 9 + .../annotations/OpenAPIDefinition.java | 9 + .../openapi/annotations/PathItem.java | 99 ++++++++++ .../annotations/PathItemOperation.java | 176 ++++++++++++++++++ .../annotations/callbacks/Callback.java | 10 + .../annotations/callbacks/package-info.java | 2 +- .../openapi/annotations/package-info.java | 2 +- 7 files changed, 305 insertions(+), 2 deletions(-) create mode 100644 api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItem.java create mode 100644 api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItemOperation.java diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java index abb1d56c..122db138 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/Components.java @@ -107,6 +107,15 @@ */ Callback[] callbacks() default {}; + /** + * An object to hold reusable Path Item Objects. + * + * @return the reusable PathItem objects. + * + * @since 4.0 + */ + PathItem[] pathItems() default {}; + /** * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.Components Components} model * corresponding to the containing annotation. diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java index 2459313f..9f2da51e 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java @@ -93,6 +93,15 @@ */ ExternalDocumentation externalDocs() default @ExternalDocumentation; + /** + * An array of webhook definitions which the API may be instructed to call using out-of-band mechanisms. + * + * @return the array of webhooks + * + * @since 4.0 + */ + PathItem[] webhooks() default {}; + /** * An element to hold a set of reusable objects for different aspects of the OpenAPI Specification (OAS). * diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItem.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItem.java new file mode 100644 index 00000000..c6238096 --- /dev/null +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItem.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.eclipse.microprofile.openapi.annotations.extensions.Extension; +import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; +import org.eclipse.microprofile.openapi.annotations.servers.Server; + +/** + * Describes a set of operations available on a single path. + * + * @since 4.0 + */ +@Target({}) +@Retention(RetentionPolicy.RUNTIME) +public @interface PathItem { + + /** + * The name of the Path Item object, used as the map key when the path item is used under + * {@link Components#pathItems()} or {@link OpenAPIDefinition#webhooks()} + * + * @return the path item name + */ + String name(); + + /** + * Reference value to a PathItem object. + *

    + * This property provides a reference to an object defined elsewhere. + *

    + * Unlike {@code ref} on most MP OpenAPI annotations, this property is not mutually exclusive with other + * properties. + * + * @return reference to a path item object definition + **/ + String ref() default ""; + + /** + * The summary of the path item. + * + * @return the summary + */ + String summary() default ""; + + /** + * The description of the path item. + * + * @return the description + */ + String description() default ""; + + /** + * The operations available under this Path Item. + *

    + * The {@link PathItemOperation#method() method} MUST be defined for each operation. + * + * @return the list of operations + */ + PathItemOperation[] operations() default {}; + + /** + * A list of servers to be used for this Path Item, overriding those defined for the whole API. + * + * @return the list of servers + */ + Server[] servers() default {}; + + /** + * A list of parameters which apply to all operations under this path item. + * + * @return the list of parameters + */ + Parameter[] parameters() default {}; + + /** + * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.PathItem PathItem} model + * corresponding to the containing annotation. + * + * @return the list of extensions + */ + Extension[] extensions() default {}; +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItemOperation.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItemOperation.java new file mode 100644 index 00000000..261928a7 --- /dev/null +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItemOperation.java @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + *

    + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

    + * http://www.apache.org/licenses/LICENSE-2.0 + *

    + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.eclipse.microprofile.openapi.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.eclipse.microprofile.openapi.annotations.callbacks.Callback; +import org.eclipse.microprofile.openapi.annotations.extensions.Extension; +import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; +import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; +import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirementsSet; +import org.eclipse.microprofile.openapi.annotations.servers.Server; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; + +/** + * Describes an Operation + *

    + * This annotation is only used for operations defined under a {@link PathItem}. For operations provided by the API + * itself, it's more common to use the {@link Operation} annotation applied to a Jakarta REST resource method instead. + * + * @since 4.0 + */ +@Target({}) +@Retention(RetentionPolicy.RUNTIME) +public @interface PathItemOperation { + + /** + * The HTTP method for this operation. + * + * @return the HTTP method of this operation + **/ + String method(); + + /** + * The tags which apply to this operation. + * + * @return the list of tags + */ + Tag[] tags() default {}; + + /** + * Provides a brief description of what this operation does. + * + * @return a summary of this operation + **/ + String summary() default ""; + + /** + * A verbose description of the operation behavior. CommonMark syntax MAY be used for rich text representation. + * + * @return a description of this operation + **/ + String description() default ""; + + /** + * Additional external documentation for this operation. + * + * @return external documentation associated with this operation instance + **/ + ExternalDocumentation externalDocs() default @ExternalDocumentation(); + + /** + * Unique string used to identify the operation. The id MUST be unique among all operations described in the API. + *

    + * Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to + * follow common programming naming conventions. + *

    + * + * @return the ID of this operation + **/ + String operationId() default ""; + + /** + * An array of parameters applicable for this operation. + *

    + * The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and + * location. + *

    + * + * @return the list of parameters for this operation + **/ + Parameter[] parameters() default {}; + + /** + * The request body for this operation. + * + * @return the request body of this operation + **/ + RequestBody requestBody() default @RequestBody(); + + /** + * The list of possible responses that can be returned when executing this operation. + * + * @return the list of responses for this operation + **/ + APIResponse[] responses() default {}; + + /** + * A list of possible out-of-band callbacks related to this operation. Each entry represents a set of requests that + * may be initiated by the API provided and an expression, evaluated at runtime, that identifies the URL used to + * make those requests. + * + * @return the list of callbacks for this operation + */ + Callback[] callbacks() default {}; + + /** + * Allows an operation to be marked as deprecated + *

    + * Consumers SHOULD refrain from usage of a deprecated operation. + *

    + * + * @return whether or not this operation is deprecated + **/ + boolean deprecated() default false; + + /** + * A declaration of which security mechanisms can be used for this callback operation. Only one of the security + * requirement objects need to be satisfied to authorize a request. + *

    + * Adding a {@code SecurityRequirement} to this array is equivalent to adding a {@code SecurityRequirementsSet} + * containing a single {@code SecurityRequirement} to {@link #securitySets()}. + *

    + * This definition overrides any declared top-level security. To remove a top-level security declaration, an empty + * array can be used. + * + * @return the list of security mechanisms for this operation + */ + SecurityRequirement[] security() default {}; + + /** + * A declaration of which security mechanisms can be used for this callback operation. All of the security + * requirements within any one of the sets needs needs to be satisfied to authorize a request. + *

    + * This definition overrides any declared top-level security. To remove a top-level security declaration, an empty + * array can be used. + *

    + * Including an empty set within this list indicates that the other requirements are optional. + * + * @return the list of security mechanisms for this operation + */ + SecurityRequirementsSet[] securitySets() default {}; + + /** + * A list of servers to be used for this operation, overriding those defined for the parent path item or for the + * whole API. + * + * @return the list of servers + */ + Server[] servers() default {}; + + /** + * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.Operation Operation} model + * corresponding to the containing annotation. + * + * @return array of extensions + */ + Extension[] extensions() default {}; +} diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java index 94d3b526..9106a388 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/Callback.java @@ -77,6 +77,16 @@ **/ String ref() default ""; + /** + * Reference value to a Path Item object, to be referenced by the Callback object. + *

    + * This property provides a reference to a Path Item object defined elsewhere. {@code #callbackUrlExpression()} is + * REQUIRED when this property is set. The referenced Path Item will be used for the URL expression specified. + * + * @since 4.0 + */ + String pathItemRef() default ""; + /** * List of extensions to be added to the {@link org.eclipse.microprofile.openapi.models.callbacks.Callback Callback} * model corresponding to the containing annotation. diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/package-info.java index fcb926f5..4eb880e7 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/callbacks/package-info.java @@ -44,6 +44,6 @@ * */ -@org.osgi.annotation.versioning.Version("1.1") +@org.osgi.annotation.versioning.Version("1.2") @org.osgi.annotation.versioning.ProviderType package org.eclipse.microprofile.openapi.annotations.callbacks; \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java index 8963a720..6bbd7b54 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/package-info.java @@ -34,5 +34,5 @@ * */ -@org.osgi.annotation.versioning.Version("1.1") +@org.osgi.annotation.versioning.Version("1.2") package org.eclipse.microprofile.openapi.annotations; \ No newline at end of file From 9117ff2a3bedee698e265fb8bc95db4389d618fa Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 5 Jun 2024 17:57:45 +0100 Subject: [PATCH 072/121] Add TCKs for PathItem annotations - Define a PathItem under Components - test all parameters - Define Operations under a Path Item - test all parameters - Define a webhook - Reference a Path Item from a webhook - Reference a Path Item from a callback - Reference a Path Item from another Path Item under Components --- .../openapi/apps/airlines/JAXRSApp.java | 120 +++++++++++++++++- .../openapi/tck/AirlinesAppTest.java | 82 ++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index e9cc8a2d..9975c627 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -20,6 +20,8 @@ import org.eclipse.microprofile.openapi.annotations.Components; import org.eclipse.microprofile.openapi.annotations.ExternalDocumentation; import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition; +import org.eclipse.microprofile.openapi.annotations.PathItem; +import org.eclipse.microprofile.openapi.annotations.PathItemOperation; import org.eclipse.microprofile.openapi.annotations.callbacks.Callback; import org.eclipse.microprofile.openapi.annotations.callbacks.CallbackOperation; import org.eclipse.microprofile.openapi.annotations.enums.ParameterIn; @@ -60,6 +62,7 @@ import jakarta.ws.rs.core.Application; import jakarta.ws.rs.core.MediaType; +@SuppressWarnings("checkstyle:linelength") // indentation of annotations leads to long lines @ApplicationPath("/") @OpenAPIDefinition( tags = {@Tag(name = "user", description = "Operations about user"), @@ -107,6 +110,27 @@ extensions = @Extension(name = "x-server", value = "test-server")), @Server(url = "https://test-server.com:80/basePath", description = "The test API server") }, + webhooks = { + @PathItem(name = "bookingEvent", + description = "Notifies about booking creation and deletion", + summary = "Booking Events", + operations = { + @PathItemOperation(method = "put", + summary = "Notifies that a booking has been created", + requestBody = @RequestBody(content = @Content(mediaType = "application/json", + schema = @Schema(ref = "#/components/schemas/Booking"))), + responses = @APIResponse(responseCode = "204", + description = "Indicates that the creation event was processed successfully")), + @PathItemOperation(method = "delete", + summary = "Notifies that a booking has been deleted", + requestBody = @RequestBody(content = @Content(mediaType = "application/json", + schema = @Schema(ref = "#/components/schemas/Booking"))), + responses = @APIResponse(responseCode = "204", + description = "Indicates that the deletion event was processed successfully")) + }, + extensions = @Extension(name = "x-webhook", value = "test-webhook")), + @PathItem(name = "userEvent", ref = "UserEvent") + }, components = @Components( schemas = { @Schema(name = "Bookings", title = "Bookings", @@ -219,7 +243,101 @@ @APIResponse(ref = "FoundBookings") })), @Callback(name = "GetBookingsARef", - ref = "#/components/callbacks/GetBookings") + ref = "#/components/callbacks/GetBookings"), + @Callback(name = "UserEvents", + callbackUrlExpression = "http://localhost:9080/users/events", + pathItemRef = "UserEvent") + }, + pathItems = { + @PathItem(name = "UserEvent", + description = "Standard definition for receiving events about users", + summary = "User Event reception API", + operations = { + @PathItemOperation( + method = "PUT", + summary = "User added event", + description = "A user was added", + externalDocs = @ExternalDocumentation(url = "http://example.com/docs"), + operationId = "userAddedEvent", + parameters = @Parameter(name = "authenticated", + description = "Whether the user is authenticated", + in = ParameterIn.QUERY, + schema = @Schema(type = SchemaType.BOOLEAN), + required = false), + requestBody = @RequestBody( + description = "The added user", + content = @Content(mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(ref = "User"))), + responses = { + @APIResponse(responseCode = "200", + description = "Event received"), + @APIResponse(responseCode = "429", + description = "Server is too busy to process the event. It will be sent again later") + }), + @PathItemOperation( + method = "DELETE", + summary = "A user was deleted", + parameters = @Parameter(name = "id", + in = ParameterIn.QUERY, + schema = @Schema(type = SchemaType.STRING), + required = true), + responses = { + @APIResponse(responseCode = "200", + description = "Event received") + }) + }), + @PathItem(name = "UserEventARef", + ref = "#/components/pathItems/UserEvent", + description = "UserEvent reference", + summary = "Referenced PathItem", + operations = @PathItemOperation( + method = "POST", + summary = "User updated event", + description = "A user was modified", + requestBody = @RequestBody( + description = "The modified user", + content = @Content(mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(ref = "User"))), + responses = { + @APIResponse(responseCode = "200", + description = "Event received") + })), + @PathItem(name = "CallbackPathItem", + operations = @PathItemOperation( + method = "POST", + responses = @APIResponse(responseCode = "200"), + callbacks = @Callback(name = "getBookings", + ref = "#/components/callbacks/GetBookings"))), + // Test remaining properties on PathItemOperation + @PathItem(name = "OperationTest", + operations = @PathItemOperation( + method = "POST", + responses = @APIResponse(responseCode = "200"), + deprecated = true, + tags = { + @Tag(ref = "create"), + @Tag(name = "pathItemTest", + description = "part of the path item tests") + }, + security = @SecurityRequirement(name = "testScheme1"), + securitySets = @SecurityRequirementsSet({}), + servers = @Server(url = "http://old.example.com/api"), + extensions = @Extension(name = "x-operation", + value = "test operation"))), + // Test remaining properties on PathItem + @PathItem(name = "PathItemTest", + operations = { + @PathItemOperation(method = "POST", + responses = @APIResponse(responseCode = "200")), + @PathItemOperation(method = "PUT", + responses = @APIResponse(responseCode = "200")) + }, + servers = @Server(url = "http://example.com"), + parameters = @Parameter(name = "id", + in = ParameterIn.PATH, + schema = @Schema(type = SchemaType.STRING)), + extensions = @Extension(name = "x-pathItem", + value = "test path item")) }, extensions = @Extension(name = "x-components", value = "test-components")), extensions = @Extension(name = "x-openapi-definition", value = "test-openapi-definition")) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 1b427048..35512762 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -23,6 +23,7 @@ import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.hasEntry; @@ -472,6 +473,10 @@ public void testCallbackAnnotations(String type) { endpoint = "paths.'/bookings'.post.callbacks"; vr.body(endpoint, hasKey("bookingCallback")); vr.body(endpoint + ".'bookingCallback'", hasKey("http://localhost:9080/airlines/bookings")); + + endpoint = "components.callbacks.UserEvents"; + vr.body(endpoint, hasKey("http://localhost:9080/users/events")); + vr.body(endpoint + ".'http://localhost:9080/users/events'.$ref", equalTo("#/components/pathItems/UserEvent")); } @Test(dataProvider = "formatProvider") @@ -871,6 +876,7 @@ public void testComponents(String type) { vr.body("components.securitySchemes.httpTestScheme", notNullValue()); vr.body("components.links.UserName", notNullValue()); vr.body("components.callbacks.GetBookings", notNullValue()); + vr.body("components.pathItems.UserEvent", notNullValue()); // Test an extension on the components object itself vr.body("components.x-components", equalTo("test-components")); @@ -1186,6 +1192,82 @@ public void testRef(String type) { vr.body("components.callbacks.GetBookingsARef.$ref", equalTo("#/components/callbacks/GetBookings")); + + vr.body("components.pathItems.UserEventARef.$ref", equalTo("#/components/pathItems/UserEvent")); + vr.body("components.pathItems.UserEventARef.description", equalTo("UserEvent reference")); + vr.body("components.pathItems.UserEventARef.summary", equalTo("Referenced PathItem")); + } + + @Test(dataProvider = "formatProvider") + public void testPathItem(String type) { + ValidatableResponse vr = callEndpoint(type); + + String pathItem = "components.pathItems.UserEvent"; + vr.body(pathItem + ".description", equalTo("Standard definition for receiving events about users")); + vr.body(pathItem + ".summary", equalTo("User Event reception API")); + vr.body(pathItem + ".put", notNullValue()); + vr.body(pathItem + ".delete", notNullValue()); + + pathItem = "components.pathItems.PathItemTest"; + vr.body(pathItem + ".servers[0].url", equalTo("http://example.com")); + vr.body(pathItem + ".parameters[0].name", equalTo("id")); + vr.body(pathItem + ".x-pathItem", equalTo("test path item")); + + pathItem = "components.pathItems.UserEventARef"; + vr.body(pathItem + ".$ref", equalTo("#/components/pathItems/UserEvent")); + vr.body(pathItem + ".post", notNullValue()); + vr.body(pathItem + ".post.summary", equalTo("User updated event")); + } + + @Test(dataProvider = "formatProvider") + public void testPathItemOperation(String type) { + ValidatableResponse vr = callEndpoint(type); + + String op = "components.pathItems.UserEvent.put"; + vr.body(op, notNullValue()); + vr.body(op + ".summary", equalTo("User added event")); + vr.body(op + ".description", equalTo("A user was added")); + vr.body(op + ".externalDocs.url", equalTo("http://example.com/docs")); + vr.body(op + ".operationId", equalTo("userAddedEvent")); + vr.body(op + ".parameters[0].name", equalTo("authenticated")); + vr.body(op + ".requestBody.description", equalTo("The added user")); + vr.body(op + ".responses.'200'.description", equalTo("Event received")); + vr.body(op + ".responses.'429'.description", containsString("Server is too busy")); + + op = "components.pathItems.CallbackPathItem.post"; + vr.body(op, notNullValue()); + vr.body(op + ".callbacks.getBookings.$ref", equalTo("#/components/callbacks/GetBookings")); + + op = "components.pathItems.OperationTest.post"; + vr.body(op, notNullValue()); + vr.body(op + ".tags", containsInAnyOrder("create", "pathItemTest")); + vr.body(op + ".deprecated", equalTo(true)); + vr.body(op + ".security", hasSize(2)); + vr.body(op + ".security", hasItem(anEmptyMap())); + // JsonPath syntax sucks - this expects security to contain two items, one of which + // maps "testScheme1" to an empty list and the other of which doesn't have a "testScheme1" entry. + vr.body(op + ".security.testScheme1", containsInAnyOrder(emptyIterable(), nullValue())); + vr.body(op + ".servers[0].url", equalTo("http://old.example.com/api")); + vr.body(op + ".x-operation", equalTo("test operation")); + + // Check the new tag was created + vr.body("tags.findAll { it.name == 'pathItemTest'}.description", contains("part of the path item tests")); } + @Test(dataProvider = "formatProvider") + public void testWebhooks(String type) { + ValidatableResponse vr = callEndpoint(type); + + String webhook = "webhooks.bookingEvent"; + vr.body(webhook, notNullValue()); + vr.body(webhook + ".description", equalTo("Notifies about booking creation and deletion")); + vr.body(webhook + ".summary", equalTo("Booking Events")); + vr.body(webhook + ".put", notNullValue()); + vr.body(webhook + ".delete", notNullValue()); + vr.body(webhook + ".x-webhook", equalTo("test-webhook")); + + webhook = "webhooks.userEvent"; + vr.body(webhook, notNullValue()); + vr.body(webhook + ".$ref", equalTo("#/components/pathItems/UserEvent")); + } } From 3589db94e448f66a5c03cf28c493bec2a91a7d42 Mon Sep 17 00:00:00 2001 From: Benjamin Confino Date: Wed, 29 May 2024 21:29:02 +0100 Subject: [PATCH 073/121] test multipart encoding with new fields --- .../openapi/annotations/media/Encoding.java | 3 +- .../airlines/resources/ZepplinResource.java | 39 +++++++++++++++++++ .../openapi/tck/AirlinesAppTest.java | 14 +++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java index 7d5dd78d..f23e1ffe 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java @@ -58,7 +58,8 @@ /** * Style describes how the encoding value will be serialized depending on the type of the parameter value. This - * property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded. + * property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded or + * multipart/form-data. *

    * Default values include: form, spaceDelimited, pipeDelimited, and deepObject. *

    diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java index 8c1afc72..fa2a47df 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/resources/ZepplinResource.java @@ -13,20 +13,28 @@ package org.eclipse.microprofile.openapi.apps.airlines.resources; +import java.util.List; + import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.enums.ParameterIn; import org.eclipse.microprofile.openapi.annotations.enums.ParameterStyle; import org.eclipse.microprofile.openapi.annotations.enums.SchemaType; import org.eclipse.microprofile.openapi.annotations.enums.SecuritySchemeType; +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.media.Encoding; import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.eclipse.microprofile.openapi.annotations.media.SchemaProperty; import org.eclipse.microprofile.openapi.annotations.parameters.Parameter; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.security.SecurityRequirement; import org.eclipse.microprofile.openapi.annotations.security.SecurityScheme; +import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.GET; import jakarta.ws.rs.HEAD; +import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Response; @@ -71,4 +79,35 @@ public Response headZepplin() { public Response getZepplin() { return Response.ok().build(); } + + @POST + @APIResponse(responseCode = "200", description = "Review posted") + @APIResponse(responseCode = "404", description = "Review not found") + @Operation(summary = "Post by Zepplin", operationId = "postZepplin") + @Produces("text/plain") + @SecurityRequirement(name = "mutualTLSScheme", scopes = "zepplinScope") + @Consumes("multipart/form-data") + public Response postZepplin( + @RequestBody(description = "Record of a new user to be created in the system.", required = true, + content = @Content(mediaType = "multipart/form-data", + schema = @Schema(properties = { + @SchemaProperty(name = "passenger", description = "the passanger", + type = SchemaType.STRING), + @SchemaProperty(name = "allergies", + description = "Does the passenger have any allergies", + type = SchemaType.ARRAY), + @SchemaProperty(name = "specialRequests", + description = "Does the passenger have any special requests", + type = SchemaType.OBJECT) + }), + encoding = { + @Encoding(name = "allergies", + allowReserved = true, explode = true, + style = "pipeDelimited"), + @Encoding(name = "specialRequests", + allowReserved = true, explode = true, + style = "spaceDelimited") + })) List zeeplinUsers) { + return Response.ok().build(); + } } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index 8f5092bc..db57d16a 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -711,6 +711,20 @@ public void testEncodingResponses(String type) { vr.body(t + "style", equalTo("form")); vr.body(t + "explode", equalTo(true)); vr.body(t + "allowReserved", equalTo(true)); + + // Test style, explode and allowReserved when @Consumes is "multipart/form-data" + String allergiesEncoding = + "paths.'/zepplins'.post.requestBody.content.'multipart/form-data'.encoding.allergies"; + String specialRequestsEncoding = + "paths.'/zepplins'.post.requestBody.content.'multipart/form-data'.encoding.specialRequests"; + + vr.body(allergiesEncoding + ".style", equalTo("pipeDelimited")); + vr.body(allergiesEncoding + ".explode", equalTo(true)); + vr.body(allergiesEncoding + ".allowReserved", equalTo(true)); + + vr.body(specialRequestsEncoding + ".style", equalTo("spaceDelimited")); + vr.body(specialRequestsEncoding + ".explode", equalTo(true)); + vr.body(specialRequestsEncoding + ".allowReserved", equalTo(true)); } @Test(dataProvider = "formatProvider") From 04a64e2a46fd2b64998a8432e69f438ac5347792 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 11 Jun 2024 13:22:41 +0100 Subject: [PATCH 074/121] Add ZeppelinResource to application All the resource classes we expect to be scanned should be part of the application. --- .../eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java index 21fe1053..60f9eefb 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/airlines/JAXRSApp.java @@ -56,6 +56,7 @@ import org.eclipse.microprofile.openapi.apps.airlines.resources.AvailabilityResource; import org.eclipse.microprofile.openapi.apps.airlines.resources.ReviewResource; import org.eclipse.microprofile.openapi.apps.airlines.resources.UserResource; +import org.eclipse.microprofile.openapi.apps.airlines.resources.ZepplinResource; import org.eclipse.microprofile.openapi.apps.airlines.resources.bookings.BookingResource; import jakarta.ws.rs.ApplicationPath; @@ -372,6 +373,7 @@ public Set getSingletons() { singletons.add(new BookingResource()); singletons.add(new ReviewResource()); singletons.add(new UserResource()); + singletons.add(new ZepplinResource()); return singletons; } From 0ca0ca4199d1af028b44e8978cc4c0a82ac688c2 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 11 Jun 2024 16:22:22 +0000 Subject: [PATCH 075/121] [maven-release-plugin] prepare release --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..2a3c9722 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 5a6e2e1e..d9173015 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..017d4c4b 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..3272f04f 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index f2e5dfbe..fb1a560f 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-tck From 473378c41b4ff817ce32f07e2f31c295ee179d66 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Tue, 11 Jun 2024 12:55:50 -0400 Subject: [PATCH 076/121] Revert "[maven-release-plugin] prepare release 4.0-RC1" (#633) This reverts commit 0ca0ca4199d1af028b44e8978cc4c0a82ac688c2. --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 2a3c9722..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index d9173015..5a6e2e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 017d4c4b..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 3272f04f..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index fb1a560f..f2e5dfbe 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-tck From 932bc36300d8c706340408475b3b965a76a5a33e Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 11 Jun 2024 16:59:05 +0000 Subject: [PATCH 077/121] [maven-release-plugin] prepare release 4.0-RC1 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..2a3c9722 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 5a6e2e1e..acedc161 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0-RC1 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..017d4c4b 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..3272f04f 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index f2e5dfbe..fb1a560f 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC1 microprofile-openapi-tck From b6e2d832d3f6eb153c88ab2ccae5e49769d78268 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 11 Jun 2024 16:59:07 +0000 Subject: [PATCH 078/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 2a3c9722..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index acedc161..5a6e2e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0-RC1 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 017d4c4b..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 3272f04f..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index fb1a560f..f2e5dfbe 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC1 + 4.0-SNAPSHOT microprofile-openapi-tck From 185c848b57346f68ef821b21df3aa9b486a61a90 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 11 Jun 2024 17:52:48 +0100 Subject: [PATCH 079/121] Add release notes for 4.0 --- spec/src/main/asciidoc/release_notes.asciidoc | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/spec/src/main/asciidoc/release_notes.asciidoc index 6b010643..08a2ba32 100644 --- a/spec/src/main/asciidoc/release_notes.asciidoc +++ b/spec/src/main/asciidoc/release_notes.asciidoc @@ -16,6 +16,61 @@ // See the License for the specific language governing permissions and // limitations under the License. +[[release_notes_40]] +== Release Notes for MicroProfile OpenAPI 4.0 + +A full list of changes delivered in the 4.0 release can be found at link:https://github.com/eclipse/microprofile-open-api/milestone/6?closed=1[MicroProfile OpenAPI 4.0 Milestone] + +[[incompatible_changes_40]] +=== Incompatible Changes + +* `/openapi` endpoint now serves documentation in OpenAPI v3.1 format (https://github.com/eclipse/microprofile-open-api/issues/333[333]) +* Incompatible changes to the `Schema` model API, reflecting changes in the OpenAPI v3.1 document format (https://github.com/eclipse/microprofile-open-api/issues/584[584]) +** `type` property type changed from `SchemaType` to `List` +** `exclusiveMinimum` and `exclusiveMaximum` property types changed from `Boolean` to `BigDecimal` +** `nullable` property removed (replaced by the addition of `NULL` to `SchemaType`) +* `@RequestBody.required` changed to `true` to reflect that this is the much more common case where a RESTful resource method accepts a request body (https://github.com/eclipse/microprofile-open-api/issues/349[349]) +* Minimum Java version increased to 11 + +[[api_changes_40]] +=== API/SPI changes + +* Model API changes, reflecting changes in the OpenAPI v3.1 document format +** New `OpenAPI` property: `webhooks` (https://github.com/eclipse/microprofile-open-api/issues/583[583]) +** New `Components` property: `pathItems` (https://github.com/eclipse/microprofile-open-api/issues/437[437]) +** New `Info` property: `summary` (https://github.com/eclipse/microprofile-open-api/issues/435[435]) +** New `License` property: `identifier` (https://github.com/eclipse/microprofile-open-api/issues/436[436]) +** New `Schema` properties: `booleanSchema`, `comment`, `constValue`, `contains`, `contentEncoding`, `contentMediaType`, `contentSchema`, `dependentRequired`, `dependentSchemas`, `elseSchema`, `examples`, `ifSchema`, `maxContains`, `minContains`, `patternProperties`, `prefixItems`, `propertyNames`, `schemaDialect`, `thenSchema`, `unevaluatedItems`, `unevaluatedProperties` (https://github.com/eclipse/microprofile-open-api/issues/584[584]), (https://github.com/eclipse/microprofile-open-api/issues/567[567]) +** New `Schema.SchemaType` enum value: `NULL` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) +** New `SecuritySchema.Type` enum value: `MUTUALTLS` (https://github.com/eclipse/microprofile-open-api/issues/582[582]) +* Annotation API changes, reflecting changes in the OpenAPI v3.1 document format +** New `@OpenAPIDefinition` property: `webhooks` (https://github.com/eclipse/microprofile-open-api/issues/583[583]) +** New `@Components` property: `pathItems` (https://github.com/eclipse/microprofile-open-api/issues/437[437]) +** New annotation `@PathItem` (https://github.com/eclipse/microprofile-open-api/issues/437[437]) +** New annotation `@PathItemOperation` (https://github.com/eclipse/microprofile-open-api/issues/437[437]) +** New `@Callback` property: `pathItemRef` (https://github.com/eclipse/microprofile-open-api/issues/437[437]) +** New `@Info` property: `summary` (https://github.com/eclipse/microprofile-open-api/issues/435[435]) +** New `@License` property: `identifier` (https://github.com/eclipse/microprofile-open-api/issues/436[436]) +** New `@Schema` properties: `comment`, `constValue`, `contains`, `contentEncoding`, `contentMediaType`, `contentSchema`, `dependentRequired`, `dependentSchemas`, `elseSchema`, `examples`, `ifSchema`, `maxContains`, `minContains`, `patternProperties`, `prefixItems`, `propertyNames`, `thenSchema` (https://github.com/eclipse/microprofile-open-api/issues/584[584]), (https://github.com/eclipse/microprofile-open-api/issues/567[567]) +** New `@SchemaProperty` properties: `additionalProperties`, `comment`, `constValue`, `contains`, `contentEncoding`, `contentMediaType`, `contentSchema`, `dependentRequired`, `dependentSchemas`,`elseSchema`, `examples`, `ifSchema`, `maxContains`, `minContains`, `patternProperties`, `prefixItems`, `propertyNames`, `thenSchema` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) +** New annotations supporting the new `@Schema` properties: `@DependentRequired`, `@DependentSchema`, `@PatternProperty` (https://github.com/eclipse/microprofile-open-api/issues/584[584]), (https://github.com/eclipse/microprofile-open-api/issues/567[567]) +** New `SecuritySchemeType` enum value: `MUTUALTLS` (https://github.com/eclipse/microprofile-open-api/issues/582[582]) +* Added `module-info` to the API jar (https://github.com/eclipse/microprofile-open-api/pull/577[577]) + +[[other_changes_40]] +=== Other changes + +* Update references to the OpenAPI spec to point to v3.1 (https://github.com/eclipse/microprofile-open-api/pull/606[606]) +* Update documentation and TCKs to reflect changes in OpenAPI v3.1 which don't affect the model API +** All security schemes may define required roles (https://github.com/eclipse/microprofile-open-api/issues/590[590]) +** Summary and description are now valid when `$ref` is set (https://github.com/eclipse/microprofile-open-api/issues/589[589]) +** Operation.requestBody permitted for HTTP methods which don't allow a request body (https://github.com/eclipse/microprofile-open-api/issues/591[591]) +** Only one of Paths, Components, or Webhooks is required (https://github.com/eclipse/microprofile-open-api/issues/592[592]) +** New encoding options for `multipart/form-data` (https://github.com/eclipse/microprofile-open-api/issues/587[587]) +** New parameter style values valid for object type (https://github.com/eclipse/microprofile-open-api/issues/586[586]) +** Operation no longer requires responses (https://github.com/eclipse/microprofile-open-api/issues/585[585]) +* Replace references to "JAX-RS" with "Jakarta RESTful Web Services" (https://github.com/eclipse/microprofile-open-api/issues/574[574]) + [[release_notes_31]] == Release Notes for MicroProfile OpenAPI 3.1 From ca2c3aa252bc6a4804c186ba09114fd7a17d2ad1 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 14 Jun 2024 17:37:39 +0100 Subject: [PATCH 080/121] Depend on a single hamcrest version Previously we were depending on two separate hamcrest jars and restassured was bringing in a third. --- pom.xml | 2 +- tck/pom.xml | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 5a6e2e1e..fb701d51 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 8.1.0 4.3.0 - 2.0.0.0 + 2.1 4.5.2 2.10.1 3.0.1 diff --git a/tck/pom.xml b/tck/pom.xml index f2e5dfbe..dd664bb3 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -94,13 +94,8 @@ org.hamcrest - hamcrest-all - - - - org.hamcrest - java-hamcrest - ${java-hamcrest.version} + hamcrest + ${hamcrest.version} From ee174cd5cdf8f12a3cc2f86ea2cdbc99e1a353e2 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 17 Jun 2024 16:17:02 +0100 Subject: [PATCH 081/121] Update to microprofile-parent 2.9-RC2 This requires Java 17 to build. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fb701d51..de352fc1 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.9-RC1 + 2.9-RC2 org.eclipse.microprofile.openapi From 082c6072fe5eb67c5e7a1187aa67db285db8144b Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Mon, 17 Jun 2024 16:29:47 +0100 Subject: [PATCH 082/121] Update CI workflow to use Java 17 & 21 Maven plugins used in the build now require Java 17. We still target Java 11 for our output. Also update the actions used to the latest version. --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e547c8d4..7a058194 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,14 +8,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [11, 17] + java: [17, 21] name: build with jdk ${{matrix.java}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 name: checkout - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 name: set up jdk ${{matrix.java}} with: java-version: ${{matrix.java}} From 1459b4b6241311743db3608b83b427b6f9437a90 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 18 Jun 2024 11:57:50 +0100 Subject: [PATCH 083/121] Update the parent pom to 2.9 final --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index de352fc1..95acec7d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.9-RC2 + 2.9 org.eclipse.microprofile.openapi From 848d15917555bfe10e68a21f91e07f81941a147c Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Tue, 18 Jun 2024 17:03:14 +0100 Subject: [PATCH 084/121] Avoid setting all properties to null --- .../openapi/tck/ModelConstructionTest.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index ae674fe9..410804d9 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -43,6 +43,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; @@ -1018,7 +1019,16 @@ public void mediaTypeTest() { @SuppressWarnings("deprecation") // Testing deprecated Schema methods @Test public void schemaTest() { - final Schema s = processConstructible(Schema.class); + final Schema s = processConstructible(Schema.class, Set.of("booleanSchema")); + + s.setBooleanSchema(Boolean.TRUE); + assertSame(s.getBooleanSchema(), Boolean.TRUE, "Schema.getBooleanSchema should return the value that was set"); + Schema s2 = s.booleanSchema(Boolean.FALSE); + assertSame(s2, s, "Schema.booleanSchema should return the same object"); + assertSame(s.getBooleanSchema(), Boolean.FALSE, + "Schema.getBooleanSchema should return the value that was set with the builder method"); + s.setBooleanSchema(null); + assertNull(s.getBooleanSchema(), "Should be able to set Schema.booleanSchema to null"); final Schema ap = createConstructibleInstance(Schema.class); checkSameObject(s, s.additionalPropertiesSchema(ap)); @@ -1029,7 +1039,7 @@ public void schemaTest() { checkSameObject(s, s.additionalPropertiesBoolean(Boolean.TRUE)); assertEquals(s.getAdditionalPropertiesBoolean(), Boolean.TRUE, "AdditionalProperties (Boolean type) is expected to be true"); - Schema s2 = s.getAdditionalPropertiesSchema(); + s2 = s.getAdditionalPropertiesSchema(); assertNotNull(s2, "AdditionalProperties (Schema type) is expected to be non-null"); assertEquals(s2.getBooleanSchema(), Boolean.TRUE, "AdditionalProperties (Schema type) is expected to return a boolean-true schema"); @@ -1721,6 +1731,10 @@ public void tagTest() { } private T processConstructible(Class clazz) { + return processConstructible(clazz, Collections.emptySet()); + } + + private T processConstructible(Class clazz, Set propertiesToIgnore) { final T o = createConstructibleInstance(clazz); if (o instanceof Extensible && Extensible.class.isAssignableFrom(clazz)) { processExtensible((Extensible) o); @@ -1729,9 +1743,12 @@ private T processConstructible(Class clazz) { processReference((Reference) o); } final Map properties = collectProperties(clazz); - properties.values().stream().filter((p) -> p.isComplete()).forEach((p) -> { - processConstructibleProperty(o, p, clazz); - }); + properties.values().stream() + .filter((p) -> p.isComplete()) + .filter((p) -> !propertiesToIgnore.contains(p.getName())) + .forEach((p) -> { + processConstructibleProperty(o, p, clazz); + }); return o; } From bc644a768fb9b1d5bf365de88be5ee43a9757990 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 19 Jun 2024 16:44:52 +0100 Subject: [PATCH 085/121] Update parent to version 2.10-RC1 This fixes a bug in the parent which was causing the release build to fail with when it tried to generate the sources jar twice. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 95acec7d..92936be8 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.9 + 2.10-RC1 org.eclipse.microprofile.openapi From cf7eaadd1fdf06587cab043a3b8b71220c7c5e45 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Wed, 19 Jun 2024 16:21:56 +0000 Subject: [PATCH 086/121] [maven-release-plugin] prepare release 4.0-RC2 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..18e062ec 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC2 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 92936be8..b7b3fe43 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC2 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0-RC2 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..affcd3c6 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC2 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..30199862 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC2 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index dd664bb3..8611b74c 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC2 microprofile-openapi-tck From 187fdc831347c3eb6313071868e88d1c4606f644 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Wed, 19 Jun 2024 16:21:58 +0000 Subject: [PATCH 087/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 18e062ec..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC2 + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index b7b3fe43..92936be8 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC2 + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0-RC2 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index affcd3c6..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC2 + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 30199862..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC2 + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 8611b74c..dd664bb3 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC2 + 4.0-SNAPSHOT microprofile-openapi-tck From fe5a21a5ebe08e0f737253852e6abcecd94746b7 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 11:35:29 +0100 Subject: [PATCH 088/121] Update to MP Parent 2.10 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 92936be8..f6273912 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.10-RC1 + 2.10 org.eclipse.microprofile.openapi From c68c6a3ed3e504cfbcb9cfb9433a8ac1492a3ada Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 15:23:49 +0100 Subject: [PATCH 089/121] Fix several spec mistakes - Update example to be compliant with OpenAPI v3.1 - Fix a broken example - Update Bean Validation requirements for OpenAPI v3.1 - Add schema model methods for custom properties to release notes - Update source code links to point to the main branch --- .../microprofile-openapi-spec.asciidoc | 20 ++++++++----------- spec/src/main/asciidoc/release_notes.asciidoc | 1 + 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index f0879094..a94f7799 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -211,7 +211,7 @@ library and wish to take advantage to the official MP OpenAPI interfaces. ==== Quick overview of annotations -The following annotations are found in the https://github.com/eclipse/microprofile-open-api/tree/master/api/src/main/java/org/eclipse/microprofile/openapi/annotations[org.eclipse.microprofile.openapi.annotations] package. +The following annotations are found in the https://github.com/eclipse/microprofile-open-api/tree/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations[org.eclipse.microprofile.openapi.annotations] package. [cols="1,4"] |=== @@ -387,7 +387,7 @@ post: '*/*': schema: $ref: '#/components/schemas/User' - required: true + required: true responses: default: description: no description @@ -461,7 +461,7 @@ public class ServersResource { .Output for Sample 1 [source, yaml] ---- -openapi: 3.0.2 +openapi: 3.1.0 servers: - url: http://{var1}.definition1/{var2} description: definition server 1 @@ -614,18 +614,14 @@ maxItems = b` | `minProperties = a + maxProperties = b` | `@DecimalMax(value = a)` | `number` or `integer` | `maximum = a` -| `@DecimalMax(value = a, exclusive = false)` | `number` or `integer` | `maximum = a + -exclusiveMaximum = true` +| `@DecimalMax(value = a, inclusive = false)` | `number` or `integer` | `exclusiveMaximum = a` | `@DecimalMin(value = a)` | `number` or `integer` | `minimum = a` -| `@DecimalMin(value = a, exclusive = false)` | `number` or `integer` | `minimum = a + -exclusiveMinimum = true` +| `@DecimalMin(value = a, inclusive = false)` | `number` or `integer` | `exclusiveMinimum = a` | `@Max(a)` | `number` or `integer` | `maximum = a` | `@Min(a)` | `number` or `integer` | `minimum = a` -| `@Negative` | `number` or `integer` | `maximum = 0 + -exclusiveMaximum = true` +| `@Negative` | `number` or `integer` | `exclusiveMaximum = 0` | `@NegativeOrZero` | `number` or `integer` | `maximum = 0` -| `@Positive` | `number` or `integer` | `minimum = 0 + -exclusiveMinimum = true` +| `@Positive` | `number` or `integer` | `exclusiveMinimum = 0` | `@PositiveOrZero` | `number` or `integer` | `minimum = 0` |=== @@ -656,7 +652,7 @@ This is in addition to the default locations defined by https://github.com/eclip === Programming model Application developers are able to provide OpenAPI elements via Java POJOs. The -complete set of models are found in the https://github.com/eclipse/microprofile-open-api/tree/master/api/src/main/java/org/eclipse/microprofile/openapi/models[org.eclipse.microprofile.openapi.models] package. +complete set of models are found in the https://github.com/eclipse/microprofile-open-api/tree/main/api/src/main/java/org/eclipse/microprofile/openapi/models[org.eclipse.microprofile.openapi.models] package. ==== OASFactory diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/spec/src/main/asciidoc/release_notes.asciidoc index 08a2ba32..dfd9a3ee 100644 --- a/spec/src/main/asciidoc/release_notes.asciidoc +++ b/spec/src/main/asciidoc/release_notes.asciidoc @@ -41,6 +41,7 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ ** New `Info` property: `summary` (https://github.com/eclipse/microprofile-open-api/issues/435[435]) ** New `License` property: `identifier` (https://github.com/eclipse/microprofile-open-api/issues/436[436]) ** New `Schema` properties: `booleanSchema`, `comment`, `constValue`, `contains`, `contentEncoding`, `contentMediaType`, `contentSchema`, `dependentRequired`, `dependentSchemas`, `elseSchema`, `examples`, `ifSchema`, `maxContains`, `minContains`, `patternProperties`, `prefixItems`, `propertyNames`, `schemaDialect`, `thenSchema`, `unevaluatedItems`, `unevaluatedProperties` (https://github.com/eclipse/microprofile-open-api/issues/584[584]), (https://github.com/eclipse/microprofile-open-api/issues/567[567]) +* New `Schema` methods for working with custom properties: `set(String, Object)`, `get(String)`, `setAll(Map)`, `getAll()` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) ** New `Schema.SchemaType` enum value: `NULL` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) ** New `SecuritySchema.Type` enum value: `MUTUALTLS` (https://github.com/eclipse/microprofile-open-api/issues/582[582]) * Annotation API changes, reflecting changes in the OpenAPI v3.1 document format From e4e6746dd730179060daf1cb4a0467db16d1de9d Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 15:26:44 +0100 Subject: [PATCH 090/121] Add missing since tags to Javadoc --- .../eclipse/microprofile/openapi/annotations/info/Info.java | 3 ++- .../microprofile/openapi/annotations/info/License.java | 1 + .../openapi/annotations/media/DependentRequired.java | 1 + .../openapi/annotations/media/DependentSchema.java | 1 + .../openapi/annotations/media/PatternProperty.java | 1 + .../org/eclipse/microprofile/openapi/models/Components.java | 3 +++ .../org/eclipse/microprofile/openapi/models/info/Info.java | 3 +++ .../eclipse/microprofile/openapi/models/info/License.java | 5 ++++- .../eclipse/microprofile/openapi/models/media/Schema.java | 6 +++++- 9 files changed, 21 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java index d4138912..de5a0bcb 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/Info.java @@ -79,7 +79,8 @@ * The summary of the API. * * @return the summary for the API - **/ + * @since 4.0 + */ String summary() default ""; /** diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java index b745e119..60dc7357 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/info/License.java @@ -44,6 +44,7 @@ * The license identifier used for the API. * * @return the identifier of the license + * @since 4.0 **/ String identifier() default ""; diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java index 786dcdae..dc410ffb 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java @@ -22,6 +22,7 @@ * properties with the names in {@link #requires()}. * * @see Schema#dependentRequired() + * @since 4.0 */ public @interface DependentRequired { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java index 4e7b0091..6ea7af42 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java @@ -22,6 +22,7 @@ * validate against {@link #schema()}. * * @see Schema#dependentSchemas() + * @since 4.0 */ public @interface DependentSchema { diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java index e9531a53..9b0c7553 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java @@ -26,6 +26,7 @@ * which validate against {@link #schema()}. * * @see Schema#patternProperties() + * @since 4.0 */ @Target({}) @Retention(RetentionPolicy.RUNTIME) diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java index 6f8ab497..b2dd8e10 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/Components.java @@ -488,6 +488,7 @@ default Components callbacks(Map callbacks) { * elsewhere in the OpenAPI document. * * @return a copy Map (potentially immutable) of path items + * @since 4.0 */ Map getPathItems(); @@ -497,6 +498,7 @@ default Components callbacks(Map callbacks) { * * @param pathItems * a map of path items + * @since 4.0 */ void setPathItems(Map pathItems); @@ -507,6 +509,7 @@ default Components callbacks(Map callbacks) { * @param pathItems * a map of path items * @return the current Schema instance + * @since 4.0 */ default Components pathItems(Map pathItems) { setPathItems(pathItems); diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java index 2644aeb8..6d8f58dd 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/Info.java @@ -204,6 +204,7 @@ default Info version(String version) { * Returns the summary of the exposed API from this Info instance. * * @return the summary of the exposed API + * @since 4.0 **/ String getSummary(); @@ -212,6 +213,7 @@ default Info version(String version) { * * @param summary * the summary of the exposed API + * @since 4.0 */ void setSummary(String summary); @@ -221,6 +223,7 @@ default Info version(String version) { * @param summary * the summary for the exposed API * @return this Info instance + * @since 4.0 */ default Info summary(String summary) { setSummary(summary); diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java index 38f20940..0bd93df0 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/info/License.java @@ -58,7 +58,8 @@ default License name(String name) { * Returns the license identifier for this License instance that is used for the API. * * @return the license identifier used for the API - **/ + * @since 4.0 + */ String getIdentifier(); /** @@ -66,6 +67,7 @@ default License name(String name) { * * @param identifier * the license identifier used for the API + * @since 4.0 */ void setIdentifier(String identifier); @@ -75,6 +77,7 @@ default License name(String name) { * @param identifier * the license identifier used for the API * @return this License instance + * @since 4.0 */ default License identifier(String identifier) { setIdentifier(identifier); diff --git a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java index 10bcf4b7..ed8daad1 100644 --- a/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java +++ b/api/src/main/java/org/eclipse/microprofile/openapi/models/media/Schema.java @@ -44,7 +44,7 @@ public interface Schema extends Extensible, Constructible, Reference { /** - * The values allowed for the in field. + * The values allowed for the {@code type} field. */ enum SchemaType { INTEGER("integer"), NUMBER("number"), BOOLEAN("boolean"), STRING("string"), OBJECT("object"), ARRAY( @@ -2063,6 +2063,7 @@ default Schema examples(List examples) { * @param propertyName * the property name * @return the value of the named property, or {@code null} if a property with the given name is not set + * @since 4.0 */ Object get(String propertyName); @@ -2103,6 +2104,7 @@ default Schema examples(List examples) { * @param value * the value to set, or {@code null} to remove the property * @return the current Schema instance + * @since 4.0 */ Schema set(String propertyName, Object value); @@ -2113,6 +2115,7 @@ default Schema examples(List examples) { * into a {@code Map}. * * @return a {@code Map} of property names to their corresponding values + * @since 4.0 */ Map getAll(); @@ -2124,6 +2127,7 @@ default Schema examples(List examples) { * @param allProperties * the properties to set. Each value in the map must be valid according to the rules in * {@link #set(String, Object)} + * @since 4.0 */ void setAll(Map allProperties); } From a3fe68d94e3b75b5e7ea80e5dd0f0ffa0832e663 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 15:33:28 +0100 Subject: [PATCH 091/121] Update authors list --- spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index a94f7799..b667e3cb 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -17,7 +17,7 @@ // limitations under the License. // -:authors: Arthur De Magalhaes (Spec Lead), Eric Wittmann, Anna Safonov, Matt Gill, Ivan Junckes Filho, Jérémie Bresson, Jana Manoharan, Rui Qi Wang, Tommy Wojtczak, Martin Smithson, Michael Edgar +:authors: Arthur De Magalhaes (Spec Lead), Eric Wittmann, Anna Safonov, Matt Gill, Ivan Junckes Filho, Jérémie Bresson, Jana Manoharan, Rui Qi Wang, Tommy Wojtczak, Martin Smithson, Michael Edgar, Andrew Rouse :version-label!: :sectanchors: :doctype: book From 1bae1e22560df737e650826a310cdbbed8d3c32f Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 17:08:18 +0100 Subject: [PATCH 092/121] Fix asciidoc indentation --- spec/src/main/asciidoc/release_notes.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/spec/src/main/asciidoc/release_notes.asciidoc index dfd9a3ee..b07e96f9 100644 --- a/spec/src/main/asciidoc/release_notes.asciidoc +++ b/spec/src/main/asciidoc/release_notes.asciidoc @@ -41,7 +41,7 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ ** New `Info` property: `summary` (https://github.com/eclipse/microprofile-open-api/issues/435[435]) ** New `License` property: `identifier` (https://github.com/eclipse/microprofile-open-api/issues/436[436]) ** New `Schema` properties: `booleanSchema`, `comment`, `constValue`, `contains`, `contentEncoding`, `contentMediaType`, `contentSchema`, `dependentRequired`, `dependentSchemas`, `elseSchema`, `examples`, `ifSchema`, `maxContains`, `minContains`, `patternProperties`, `prefixItems`, `propertyNames`, `schemaDialect`, `thenSchema`, `unevaluatedItems`, `unevaluatedProperties` (https://github.com/eclipse/microprofile-open-api/issues/584[584]), (https://github.com/eclipse/microprofile-open-api/issues/567[567]) -* New `Schema` methods for working with custom properties: `set(String, Object)`, `get(String)`, `setAll(Map)`, `getAll()` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) +** New `Schema` methods for working with custom properties: `set(String, Object)`, `get(String)`, `setAll(Map)`, `getAll()` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) ** New `Schema.SchemaType` enum value: `NULL` (https://github.com/eclipse/microprofile-open-api/issues/584[584]) ** New `SecuritySchema.Type` enum value: `MUTUALTLS` (https://github.com/eclipse/microprofile-open-api/issues/582[582]) * Annotation API changes, reflecting changes in the OpenAPI v3.1 document format From 080dc367d86da565931fe0c23c49806b06a662b0 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 17:08:37 +0100 Subject: [PATCH 093/121] Restore section numbers Missing since version 2.0 --- spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index b667e3cb..cac69283 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -35,6 +35,7 @@ endif::[] :sectnums!: include::license-efsl.adoc[] + :sectnums: == Introduction From 33cc7c49f0c70de3f51426beeadd0ee66de09975 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 17:21:56 +0100 Subject: [PATCH 094/121] Have a single top-level release notes section With the section numbers restored, having the release notes comprise chapters 8-13 of the spec looks a bit silly. --- spec/src/main/asciidoc/release_notes.asciidoc | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/spec/src/main/asciidoc/release_notes.asciidoc index b07e96f9..0d1c82a1 100644 --- a/spec/src/main/asciidoc/release_notes.asciidoc +++ b/spec/src/main/asciidoc/release_notes.asciidoc @@ -16,13 +16,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +[[release_notes]] +== Release Notes + [[release_notes_40]] -== Release Notes for MicroProfile OpenAPI 4.0 +=== Release Notes for MicroProfile OpenAPI 4.0 A full list of changes delivered in the 4.0 release can be found at link:https://github.com/eclipse/microprofile-open-api/milestone/6?closed=1[MicroProfile OpenAPI 4.0 Milestone] [[incompatible_changes_40]] -=== Incompatible Changes +==== Incompatible Changes * `/openapi` endpoint now serves documentation in OpenAPI v3.1 format (https://github.com/eclipse/microprofile-open-api/issues/333[333]) * Incompatible changes to the `Schema` model API, reflecting changes in the OpenAPI v3.1 document format (https://github.com/eclipse/microprofile-open-api/issues/584[584]) @@ -33,7 +36,7 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ * Minimum Java version increased to 11 [[api_changes_40]] -=== API/SPI changes +==== API/SPI changes * Model API changes, reflecting changes in the OpenAPI v3.1 document format ** New `OpenAPI` property: `webhooks` (https://github.com/eclipse/microprofile-open-api/issues/583[583]) @@ -59,7 +62,7 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ * Added `module-info` to the API jar (https://github.com/eclipse/microprofile-open-api/pull/577[577]) [[other_changes_40]] -=== Other changes +==== Other changes * Update references to the OpenAPI spec to point to v3.1 (https://github.com/eclipse/microprofile-open-api/pull/606[606]) * Update documentation and TCKs to reflect changes in OpenAPI v3.1 which don't affect the model API @@ -73,12 +76,12 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ * Replace references to "JAX-RS" with "Jakarta RESTful Web Services" (https://github.com/eclipse/microprofile-open-api/issues/574[574]) [[release_notes_31]] -== Release Notes for MicroProfile OpenAPI 3.1 +=== Release Notes for MicroProfile OpenAPI 3.1 A full list of changes delivered in the 3.1 release can be found at link:https://github.com/eclipse/microprofile-open-api/milestone/5?closed=1[MicroProfile OpenAPI 3.1 Milestone]. [[api_changes_31]] -=== API/SPI Changes +==== API/SPI Changes * Add `extensions` attribute to most annotations (https://github.com/eclipse/microprofile-open-api/issues/387[387]) * Improvements to the definition of security requirements (https://github.com/eclipse/microprofile-open-api/issues/483[483], https://github.com/eclipse/microprofile-open-api/issues/468[468]) @@ -89,7 +92,7 @@ A full list of changes delivered in the 3.1 release can be found at link:https:/ * Allow `@APIResponse` to be applied to a class, indicating that every resource method on that class has that response (https://github.com/eclipse/microprofile-open-api/issues/417[417]) [[other_changes_31]] -=== Other Changes +==== Other Changes * Add processing of some Jakarta Bean Validation annotations (https://github.com/eclipse/microprofile-open-api/issues/482[482]) * Define the precedence of the `mp.openapi.scan.*` config properties (https://github.com/eclipse/microprofile-open-api/issues/422[422]) @@ -99,22 +102,22 @@ A full list of changes delivered in the 3.1 release can be found at link:https:/ * Recommend that implementations provide a way to serve CORS headers on the `/openapi` endpoint (https://github.com/eclipse/microprofile-open-api/issues/416[416]) [[release_notes_30]] -== Release Notes for MicroProfile OpenAPI 3.0 +=== Release Notes for MicroProfile OpenAPI 3.0 A full list of changes delivered in the 3.0 release can be found at link:https://github.com/eclipse/microprofile-open-api/milestone/4?closed=1[MicroProfile OpenAPI 3.0 Milestone]. [[incompatible_changes_30]] -=== Incompatible Changes +==== Incompatible Changes This release aligns with Jakarta EE 9.1 (link:https://github.com/eclipse/microprofile-open-api/issues/487[487]), so it won’t work with earlier versions of Jakarta or Java EE. [[api_changes_30]] -==== API/SPI Changes +===== API/SPI Changes There are no functional changes introduced in this release, except the dependency updating from javax to jakarta. [[other_changes_30]] -==== Other Changes +===== Other Changes * Negative Test Scenario - @SchemaProperty Precedence Behaviour (link:https://github.com/eclipse/microprofile-open-api/issues/466[466]) * Use MediaType.APPLICATION_JSON instead of application/json in some TCKs (link:https://github.com/eclipse/microprofile-open-api/pull/471[471]) @@ -122,12 +125,12 @@ There are no functional changes introduced in this release, except the dependenc * TestNG 7.4.0 Assert.assertNotSame has a bug which causes ModelConstructionTest TCK to fail (link:https://github.com/eclipse/microprofile-open-api/issues/494[494]) [[release_notes_20]] -== Release Notes for MicroProfile OpenAPI 2.0 +=== Release Notes for MicroProfile OpenAPI 2.0 A full list of changes delivered in the 2.0 release can be found at link:https://github.com/eclipse/microprofile-open-api/milestone/2?closed=1[MicroProfile OpenAPI 2.0 Milestone]. [[incompatible_changes_20]] -=== Incompatible Changes +==== Incompatible Changes * Model interfaces that were deprecated in 1.1 have been removed: ** `Scopes` - this interface was replaced with `Map` because it did not need to be extensible (link:https://github.com/eclipse/microprofile-open-api/issues/328[328]) @@ -194,7 +197,7 @@ A full list of changes delivered in the 2.0 release can be found at link:https:/ *** `variables(ServerVariables variables)` - use `variables(Map)` instead (link:https://github.com/eclipse/microprofile-open-api/issues/245[245]) [[api_changes_20]] -=== API/SPI Changes +==== API/SPI Changes * The `@SchemaProperty` annotation has been added to allow the properties for a schema to be defined inline. (link:https://github.com/eclipse/microprofile-open-api/issues/360[360]). For example: ``` @@ -227,21 +230,21 @@ A full list of changes delivered in the 2.0 release can be found at link:https:/ ``` [[functional_changes_20]] -=== Functional Changes +==== Functional Changes * Getter methods on model interfaces that return a list or map now return a copy of the list/map containing the same items. This list/map CAN be immutable. (link:https://github.com/eclipse/microprofile-open-api/issues/240[240]) * Setter methods on model interfaces that take a list or a map as a parameter MUST not use the list/map instance directly (link:https://github.com/eclipse/microprofile-open-api/issues/284[284]) [[other_changes_20]] -=== Other Changes +==== Other Changes * JavaDoc updates to clarify the behaviour of getter methods on model interfaces that return a list or map ((link:https://github.com/eclipse/microprofile-open-api/issues/240[240]), link:https://github.com/eclipse/microprofile-open-api/pull/288[288]) * TCK updates to verify that getter methods on model interfaces return a list or map, return a copy of underlying collection ((link:https://github.com/eclipse/microprofile-open-api/issues/240[240]), link:https://github.com/eclipse/microprofile-open-api/pull/288[288]) [[release_notes_11]] -== Release Notes for MicroProfile OpenAPI 1.1 +=== Release Notes for MicroProfile OpenAPI 1.1 Changes include: @@ -266,7 +269,7 @@ Changes include: ** bug fixes, documentation updates, more convenience methods, deprecations, etc. [[release_notes_10]] -== Release Notes for MicroProfile OpenAPI 1.0 +=== Release Notes for MicroProfile OpenAPI 1.0 First official release of MP OpenAPI. Highlights of the release: From 123ed2113f71c8c04924fb93ceada3360f0541e8 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 20 Jun 2024 17:28:07 +0100 Subject: [PATCH 095/121] Fix alignment of configuration example --- spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index cac69283..725bb27c 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -157,6 +157,7 @@ object of the resulting OpenAPI document using ``name``'s value as the key. + For example, in the case where an application wishes to represent Java ``Date``s in epoch milliseconds, the following configuration could be used (line escapes and indentation added for readability): ++ [source, json] ---- mp.openapi.schema.java.util.Date = { \ From ad1f18ebe591165a20c7f62f1c87464a13fe6474 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 21 Jun 2024 12:17:47 +0100 Subject: [PATCH 096/121] Update the list of annotations in the spec for 4.0 --- spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc index 725bb27c..fa9594b4 100644 --- a/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc +++ b/spec/src/main/asciidoc/microprofile-openapi-spec.asciidoc @@ -238,9 +238,12 @@ The following annotations are found in the https://github.com/eclipse/microprofi | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/Link.java[@Link] | Represents a design-time link for a response. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/links/LinkParameter.java[@LinkParameter] | Represents a parameter to pass to the linked operation. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Content.java[@Content] | Provides schema and examples for a particular media type. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentRequired.java[@DependentRequired] | Used within `@Schema` to indicate properties that are required if another property is present. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DependentSchema.java[@DependentSchema] | Used within `@Schema` to indicate additional rules that are required if a named property is present. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/DiscriminatorMapping.java[@DiscriminatorMapping] | Used to differentiate between other schemas which may satisfy the payload description. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Encoding.java[@Encoding] | Single encoding definition to be applied to single Schema Object. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/ExampleObject.java[@ExampleObject] | Illustrates an example of a particular content. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/PatternProperty.java[@PatternProperty] | Used within `@Schema` to define validation rules for properties whose names match a regular expression. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java[@Schema] | Allows the definition of input and output data types. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/SchemaProperty.java[@SchemaProperty] | Allows the definition of a property nested within a parent @Schema. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/OpenAPIDefinition.java[@OpenAPIDefinition] | General metadata for an OpenAPI definition. @@ -249,6 +252,8 @@ The following annotations are found in the https://github.com/eclipse/microprofi | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/Parameters.java[@Parameters] | Encapsulates input parameters. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBody.java[@RequestBody] | Describes a single request body. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/parameters/RequestBodySchema.java[@RequestBodySchema] | Describes a single request body with schema implementation class. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItem.java[@PathItem] | Describes a set of operations available at the same location. Mostly only used to document webhooks as the paths for operations within the application can be discovered from Jakarta REST resources. +| https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/PathItemOperation.java[@PathItemOperation] | Used within `@PathItem` to describe an operation. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponse.java[@APIResponse] | Describes a single response from an API operation. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponses.java[@APIResponses] | A container for multiple responses from an API operation. | https://github.com/eclipse/microprofile-open-api/blob/main/api/src/main/java/org/eclipse/microprofile/openapi/annotations/responses/APIResponseSchema.java[@APIResponseSchema] | Describes a single response with schema implementation class from an API operation. From 90395a69ea0eec4d0145814d086e5cac72f40399 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 21 Jun 2024 16:50:16 +0100 Subject: [PATCH 097/121] Remove call to deprecated Integer constructor Has been deprecated for removal since Java 9. --- .../microprofile/openapi/apps/petstore/data/PetData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java index e72dbdc7..d5643a67 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/apps/petstore/data/PetData.java @@ -140,7 +140,7 @@ public Map getInventoryByStatus() { if (status != null && !"".equals(status)) { Integer count = output.get(status); if (count == null) { - count = new Integer(1); + count = 1; } else { count = count.intValue() + 1; } From fdb802f7dc627ed19dee6d1b5d3517df563073c7 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 21 Jun 2024 16:54:11 +0100 Subject: [PATCH 098/121] Missing words in the release notes --- spec/src/main/asciidoc/release_notes.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/spec/src/main/asciidoc/release_notes.asciidoc index 0d1c82a1..c77646d2 100644 --- a/spec/src/main/asciidoc/release_notes.asciidoc +++ b/spec/src/main/asciidoc/release_notes.asciidoc @@ -32,7 +32,7 @@ A full list of changes delivered in the 4.0 release can be found at link:https:/ ** `type` property type changed from `SchemaType` to `List` ** `exclusiveMinimum` and `exclusiveMaximum` property types changed from `Boolean` to `BigDecimal` ** `nullable` property removed (replaced by the addition of `NULL` to `SchemaType`) -* `@RequestBody.required` changed to `true` to reflect that this is the much more common case where a RESTful resource method accepts a request body (https://github.com/eclipse/microprofile-open-api/issues/349[349]) +* Default value of `@RequestBody.required` changed to `true` to reflect that this is the much more common case where a RESTful resource method accepts a request body (https://github.com/eclipse/microprofile-open-api/issues/349[349]) * Minimum Java version increased to 11 [[api_changes_40]] From 1aa3d91828e72f603defed67cb4ba0d61f0358cf Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Fri, 21 Jun 2024 16:05:39 +0000 Subject: [PATCH 099/121] [maven-release-plugin] prepare release 4.0-RC3 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..d03c4239 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC3 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index f6273912..d16d88bb 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC3 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0-RC3 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..4e1ee3ac 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC3 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..7d94e3bc 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC3 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index dd664bb3..460ccbd2 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC3 microprofile-openapi-tck From 4312721b85d0770086d48c112ea19278e0a33dd0 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Fri, 21 Jun 2024 16:05:41 +0000 Subject: [PATCH 100/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index d03c4239..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC3 + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index d16d88bb..f6273912 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC3 + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0-RC3 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 4e1ee3ac..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC3 + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 7d94e3bc..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC3 + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 460ccbd2..dd664bb3 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC3 + 4.0-SNAPSHOT microprofile-openapi-tck From 69b08ca8b0e22de00914c25f1979d9286df90da1 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Fri, 21 Jun 2024 16:27:08 +0000 Subject: [PATCH 101/121] [maven-release-plugin] prepare release 4.0 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..fed73a0c 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index f6273912..ea53af4c 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..a5893082 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..fc18adc4 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index dd664bb3..ab9340c8 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-tck From c16e7f66798b590802d7c4baac7e44cf6a0caae2 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Fri, 21 Jun 2024 16:27:10 +0000 Subject: [PATCH 102/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index fed73a0c..7ff65f43 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index ea53af4c..31715a4c 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index a5893082..665ee21e 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index fc18adc4..e0ffb757 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index ab9340c8..2725a8fa 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-tck From e84d367cb05777d0a483c4e31d92bf00849d5f97 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 4 Jul 2024 11:03:09 +0100 Subject: [PATCH 103/121] set version back to 4.0-SNAPSHOT --- api/pom.xml | 2 +- pom.xml | 2 +- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7ff65f43..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 31715a4c..f6273912 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI diff --git a/spec/pom.xml b/spec/pom.xml index 665ee21e..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index e0ffb757..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 2725a8fa..dd664bb3 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0-SNAPSHOT microprofile-openapi-tck From 0c19239fd6b2877bbc48cc6e068592a0a27e227c Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 4 Jul 2024 11:21:19 +0100 Subject: [PATCH 104/121] Use Rest Client 4.0 API in TCK --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f6273912..7299cbbb 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 2.1 4.5.2 2.10.1 - 3.0.1 + 4.0-RC2 3.0.1 3.0.2 From 9aedda9c336b3299fc14b883a15f5d47e9b3fd5d Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 4 Jul 2024 11:17:25 +0000 Subject: [PATCH 105/121] [maven-release-plugin] prepare release 4.0-RC4 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..08455b07 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC4 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 7299cbbb..242dd590 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC4 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0-RC4 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..e45c85a3 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC4 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..0eac66c0 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC4 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index dd664bb3..bee17b64 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0-RC4 microprofile-openapi-tck From deb180a6232d349a97cce1fca15acf6a49166cba Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 4 Jul 2024 11:17:27 +0000 Subject: [PATCH 106/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 08455b07..30e82d08 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC4 + 4.0-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 242dd590..7299cbbb 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC4 + 4.0-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0-RC4 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index e45c85a3..33695577 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC4 + 4.0-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 0eac66c0..bc08375e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC4 + 4.0-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index bee17b64..dd664bb3 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-RC4 + 4.0-SNAPSHOT microprofile-openapi-tck From 0a1f26ba9da67e11ffc34b5ecf09a5e69896bf42 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Thu, 4 Jul 2024 13:49:14 +0100 Subject: [PATCH 107/121] Use final versions of MP dependencies In preparation for release - MP Rest Client 4.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7299cbbb..b4dd43df 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 2.1 4.5.2 2.10.1 - 4.0-RC2 + 4.0 3.0.1 3.0.2 From 87aaa3bc775e4237ecd1906e73702a0f39f37796 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 4 Jul 2024 16:57:40 +0000 Subject: [PATCH 108/121] [maven-release-plugin] prepare release 4.0 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 30e82d08..fed73a0c 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index b4dd43df..084aed1a 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0 diff --git a/spec/pom.xml b/spec/pom.xml index 33695577..a5893082 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index bc08375e..fc18adc4 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index dd664bb3..ab9340c8 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0-SNAPSHOT + 4.0 microprofile-openapi-tck From 7f5c0705827c47c4535f5506b952f954fd7c3c24 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 4 Jul 2024 16:57:42 +0000 Subject: [PATCH 109/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index fed73a0c..7ff65f43 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 084aed1a..86e1f8c4 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index a5893082..665ee21e 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index fc18adc4..e0ffb757 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index ab9340c8..2725a8fa 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-tck From bf2dcd2dc5a62fe7cd5f316c333fa20787df9c67 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Wed, 10 Jul 2024 16:46:41 +0000 Subject: [PATCH 110/121] [maven-release-plugin] prepare release 4.0 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7ff65f43..fed73a0c 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 86e1f8c4..084aed1a 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0 diff --git a/spec/pom.xml b/spec/pom.xml index 665ee21e..a5893082 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index e0ffb757..fc18adc4 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 2725a8fa..ab9340c8 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-tck From 6b3dce3fcad3ad25e13ffa3ec14dc0f6ff0a44c0 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Wed, 10 Jul 2024 16:46:43 +0000 Subject: [PATCH 111/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index fed73a0c..7ff65f43 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 084aed1a..86e1f8c4 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index a5893082..665ee21e 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index fc18adc4..e0ffb757 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index ab9340c8..2725a8fa 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-tck From 4ef26f2a02251b742130b2db8b88cd7ad977ffd8 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 31 Jul 2024 22:46:06 +0100 Subject: [PATCH 112/121] Update spec license to EFSL v1.1 License text from https://www.eclipse.org/legal/adoc/efsl-1.1.adoc --- spec/src/main/asciidoc/license-efsl.adoc | 65 +++++------------------- 1 file changed, 14 insertions(+), 51 deletions(-) diff --git a/spec/src/main/asciidoc/license-efsl.adoc b/spec/src/main/asciidoc/license-efsl.adoc index aa9b8765..7d7f8629 100644 --- a/spec/src/main/asciidoc/license-efsl.adoc +++ b/spec/src/main/asciidoc/license-efsl.adoc @@ -13,64 +13,27 @@ Release: {revdate} Copyright (c) {inceptionYear}, {currentYear} Eclipse Foundation. -=== Eclipse Foundation Specification License +=== Eclipse Foundation Specification License - v1.1 -By using and/or copying this document, or the Eclipse Foundation -document from which this statement is linked, you (the licensee) agree -that you have read, understood, and will comply with the following -terms and conditions: +By using and/or copying this document, or the Eclipse Foundation document from which this statement is linked or incorporated by reference, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: -Permission to copy, and distribute the contents of this document, or -the Eclipse Foundation document from which this statement is linked, in -any medium for any purpose and without fee or royalty is hereby -granted, provided that you include the following on ALL copies of the -document, or portions thereof, that you use: +Permission to copy, and distribute the contents of this document, or the Eclipse Foundation document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: * link or URL to the original Eclipse Foundation document. -* All existing copyright notices, or if one does not exist, a notice - (hypertext is preferred, but a textual representation is permitted) - of the form: "Copyright (c) [$date-of-document] - Eclipse Foundation, Inc. \<>" - -Inclusion of the full text of this NOTICE must be provided. We -request that authorship attribution be provided in any software, -documents, or other items or products that you create pursuant to the -implementation of the contents of this document, or any portion -thereof. - -No right to create modifications or derivatives of Eclipse Foundation -documents is granted pursuant to this license, except anyone may -prepare and distribute derivative works and portions of this document -in software that implements the specification, in supporting materials -accompanying such software, and in documentation of such software, -PROVIDED that all such works include the notice below. HOWEVER, the -publication of derivative works of this document for use as a technical -specification is expressly prohibited. +* All existing copyright notices, or if one does not exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright (c) [$date-of-document] Eclipse Foundation AISBL +<>+ " + +Inclusion of the full text of this NOTICE must be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. + +No right to create modifications or derivatives of Eclipse Foundation documents is granted pursuant to this license, except anyone may prepare and distribute derivative works and portions of this document in software that implements the specification, in supporting materials accompanying such software, and in documentation of such software, PROVIDED that all such works include the notice below. HOWEVER, the publication of derivative works of this document for use as a technical specification is expressly prohibited. The notice is: -"Copyright (c) [$date-of-document] Eclipse Foundation. This software or -document includes material copied from or derived from [title and URI -of the Eclipse Foundation specification document]." +"Copyright (c) [$date-of-document] Eclipse Foundation AISBL. This software or document includes material copied from or derived from [title and URI of the Eclipse Foundation specification document]." ==== Disclaimers -THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT -HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR -WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE -SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS -WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR -OTHER RIGHTS. - -THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE -FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT -OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE -CONTENTS THEREOF. - -The name and trademarks of the copyright holders or the Eclipse -Foundation may NOT be used in advertising or publicity pertaining to -this document or its contents without specific, written prior -permission. Title to copyright in this document will at all times -remain with copyright holders. +THIS DOCUMENT IS PROVIDED "AS IS," AND TO THE EXTENT PERMITTED BY APPLICABLE LAW THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION AISBL MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + +TO THE EXTENT PERMITTED BY APPLICABLE LAW THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION AISBL WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. + +The name and trademarks of the copyright holders or the Eclipse Foundation AISBL may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. From 8a10f15b4a5a6b2e4c030cc133677384afa84a40 Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Wed, 31 Jul 2024 23:33:15 +0100 Subject: [PATCH 113/121] Update parent pom to 2.11 Updates the license included in the API javadoc to EFSL 1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 86e1f8c4..eaaacce5 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile microprofile-parent - 2.10 + 2.11 org.eclipse.microprofile.openapi From 7e7b3d2a4de76c077d0317cd1e34f485c6ab0275 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 1 Aug 2024 15:14:39 +0000 Subject: [PATCH 114/121] [maven-release-plugin] prepare release 4.0 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7ff65f43..fed73a0c 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index eaaacce5..a6a6db65 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0 diff --git a/spec/pom.xml b/spec/pom.xml index 665ee21e..a5893082 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index e0ffb757..fc18adc4 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 2725a8fa..ab9340c8 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0 microprofile-openapi-tck From 3dd79d5386fa051da1d2ed2a1594a310be391b08 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Thu, 1 Aug 2024 15:14:41 +0000 Subject: [PATCH 115/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index fed73a0c..7ff65f43 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index a6a6db65..eaaacce5 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index a5893082..665ee21e 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index fc18adc4..e0ffb757 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index ab9340c8..2725a8fa 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0 + 4.1-SNAPSHOT microprofile-openapi-tck From 394f23caa4e7132384d28d0e3b4e4a8de4364821 Mon Sep 17 00:00:00 2001 From: TomasHofman Date: Tue, 17 Sep 2024 18:10:46 +0200 Subject: [PATCH 116/121] Make ModelConstructionTest, OASFactoryErrorTest activate OpenAPI (#657) --- .../microprofile/openapi/tck/ModelConstructionTest.java | 4 +++- .../eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java index 410804d9..9482aab8 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/ModelConstructionTest.java @@ -134,7 +134,9 @@ public static void assertNotSame(Object actual, Object expected, String message) @Deployment public static WebArchive createDeployment() { - return ShrinkWrap.create(WebArchive.class); + return ShrinkWrap.create(WebArchive.class) + .addPackages(true, "org.eclipse.microprofile.openapi.reader") + .addAsManifestResource("microprofile-reader.properties", "microprofile-config.properties"); } // Container for matched getter, setter and builder methods diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java index b8d6eaaa..a6512ca2 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/OASFactoryErrorTest.java @@ -83,7 +83,9 @@ public void setIdentifier(String identifier) { @Deployment public static WebArchive createDeployment() { - return ShrinkWrap.create(WebArchive.class); + return ShrinkWrap.create(WebArchive.class) + .addPackages(true, "org.eclipse.microprofile.openapi.reader") + .addAsManifestResource("microprofile-reader.properties", "microprofile-config.properties"); } @Test(expectedExceptions = {NullPointerException.class}) From 51cfdba436a2fc384d20f631baad0aaa86baa295 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 17 Sep 2024 16:46:59 +0000 Subject: [PATCH 117/121] [maven-release-plugin] prepare release 4.0.1 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7ff65f43..9a8727e0 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.1 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index eaaacce5..79fd3b46 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.1 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0.1 diff --git a/spec/pom.xml b/spec/pom.xml index 665ee21e..26ee9766 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.1 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index e0ffb757..9781f967 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.1 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 2725a8fa..f137f1a9 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.1 microprofile-openapi-tck From 112b7b16806982223d638f415d2979beaf89f6a8 Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 17 Sep 2024 16:47:01 +0000 Subject: [PATCH 118/121] [maven-release-plugin] prepare for next development iteration --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 9a8727e0..7ff65f43 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0.1 + 4.1-SNAPSHOT microprofile-openapi-api diff --git a/pom.xml b/pom.xml index 79fd3b46..eaaacce5 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0.1 + 4.1-SNAPSHOT pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 4.0.1 + 3.1-SNAPSHOT diff --git a/spec/pom.xml b/spec/pom.xml index 26ee9766..665ee21e 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0.1 + 4.1-SNAPSHOT microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index 9781f967..e0ffb757 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0.1 + 4.1-SNAPSHOT microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index f137f1a9..2725a8fa 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.0.1 + 4.1-SNAPSHOT microprofile-openapi-tck From d544d00c800f1fa17b8865a12bbb3df2fa20b4c2 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Fri, 11 Oct 2024 08:53:02 -0400 Subject: [PATCH 119/121] Relax assertions for default header, request body, and response styles Signed-off-by: Michael Edgar Co-authored-by: Andrew Rouse --- .../openapi/tck/AirlinesAppTest.java | 18 +++++++-------- .../microprofile/openapi/tck/FilterTest.java | 3 ++- .../openapi/tck/utils/TCKMatchers.java | 23 +++++++++++++++++++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java index db57d16a..a01a280f 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/AirlinesAppTest.java @@ -16,6 +16,7 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.hasOptionalEntry; import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.anEmptyMap; @@ -408,8 +409,7 @@ private void testBookingIdMethods(ValidatableResponse vr) { } bookingParameters = "paths.'/bookings/{id}'.get.parameters"; - vr.body(bookingParameters + ".findAll { it.name == 'id' }.style", both(hasSize(1)).and(contains("simple"))); - + vr.body(bookingParameters + ".findAll { it.name == 'id' }", contains(hasOptionalEntry("style", "simple"))); } private void testAvailabilityGetParamater(ValidatableResponse vr) { @@ -690,7 +690,7 @@ public void testEncodingRequestBody(String type) { ValidatableResponse vr = callEndpoint(type); String s = "paths.'/user'.post.requestBody.content.'application/json'.encoding.email."; vr.body(s + "contentType", equalTo("text/plain")); - vr.body(s + "style", equalTo("form")); + vr.body(s, hasOptionalEntry("style", "form")); vr.body(s + "explode", equalTo(true)); vr.body(s + "allowReserved", equalTo(true)); vr.body(s + "x-encoding", equalTo("test-encoding")); @@ -702,13 +702,13 @@ public void testEncodingResponses(String type) { String s = "paths.'/user/username/{username}'.put.responses.'200'.content.'application/json'.encoding.password."; vr.body(s + "contentType", equalTo("text/plain")); - vr.body(s + "style", equalTo("form")); + vr.body(s, hasOptionalEntry("style", "form")); vr.body(s + "explode", equalTo(true)); vr.body(s + "allowReserved", equalTo(true)); String t = "paths.'/user/username/{username}'.put.responses.'200'.content.'application/xml'.encoding.password."; vr.body(t + "contentType", equalTo("text/plain")); - vr.body(t + "style", equalTo("form")); + vr.body(t, hasOptionalEntry("style", "form")); vr.body(t + "explode", equalTo(true)); vr.body(t + "allowReserved", equalTo(true)); @@ -930,7 +930,7 @@ public void testHeaderInAPIResponse(String type) { vr.body(responseHeader1 + ".required", equalTo(true)); vr.body(responseHeader1 + ".deprecated", equalTo(true)); vr.body(responseHeader1 + ".allowEmptyValue", equalTo(true)); - vr.body(responseHeader1 + ".style", equalTo("simple")); + vr.body(responseHeader1, hasOptionalEntry("style", "simple")); vr.body(responseHeader1 + ".schema.type", itemOrSingleton("integer")); String responseHeader2 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader2"; @@ -939,7 +939,7 @@ public void testHeaderInAPIResponse(String type) { vr.body(responseHeader2 + ".required", equalTo(true)); vr.body(responseHeader2 + ".deprecated", equalTo(true)); vr.body(responseHeader2 + ".allowEmptyValue", equalTo(true)); - vr.body(responseHeader2 + ".style", equalTo("simple")); + vr.body(responseHeader2, hasOptionalEntry("style", "simple")); vr.body(responseHeader2 + ".schema.type", itemOrSingleton("string")); } @@ -955,7 +955,7 @@ public void testHeaderInEncoding(String type) { vr.body(testHeader + ".required", equalTo(true)); vr.body(testHeader + ".deprecated", equalTo(true)); vr.body(testHeader + ".allowEmptyValue", equalTo(true)); - vr.body(testHeader + ".style", equalTo("simple")); + vr.body(testHeader, hasOptionalEntry("style", "simple")); vr.body(testHeader + ".schema.type", itemOrSingleton("integer")); } @@ -988,7 +988,7 @@ public void testHeaderInComponents(String type) { vr.body(maxRate + ".required", equalTo(true)); vr.body(maxRate + ".deprecated", equalTo(true)); vr.body(maxRate + ".allowEmptyValue", equalTo(true)); - vr.body(maxRate + ".style", equalTo("simple")); + vr.body(maxRate, hasOptionalEntry("style", "simple")); vr.body(maxRate + ".schema.type", itemOrSingleton("integer")); vr.body(maxRate + ".x-header", equalTo("test-header")); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java index 70d11bd7..2c3c2501 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/FilterTest.java @@ -16,6 +16,7 @@ package org.eclipse.microprofile.openapi.tck; +import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.hasOptionalEntry; import static org.eclipse.microprofile.openapi.tck.utils.TCKMatchers.itemOrSingleton; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.contains; @@ -161,7 +162,7 @@ public void testFilterHeader(String type) { vr.body(maxRate + ".required", equalTo(true)); vr.body(maxRate + ".deprecated", equalTo(true)); vr.body(maxRate + ".allowEmptyValue", equalTo(true)); - vr.body(maxRate + ".style", equalTo("simple")); + vr.body(maxRate, hasOptionalEntry("style", "simple")); vr.body(maxRate + ".schema.type", itemOrSingleton("integer")); } diff --git a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java index 61e12070..977aee30 100644 --- a/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java +++ b/tck/src/main/java/org/eclipse/microprofile/openapi/tck/utils/TCKMatchers.java @@ -15,7 +15,13 @@ */ package org.eclipse.microprofile.openapi.tck.utils; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.isA; +import static org.hamcrest.Matchers.not; import static org.hamcrest.comparator.ComparatorMatcherBuilder.comparedBy; import java.math.BigDecimal; @@ -169,4 +175,21 @@ private static BigDecimal toBigDecimal(Number number) { } } + + /** + * Creates a matcher which matches a map entry with an allowed value or the absence of a map entry from the object. + * + * @param entryName + * name of the entry in the map + * @param value + * a single allowed value in the map entry, if present + * @return the matcher + */ + @SuppressWarnings("unchecked") + public static Matcher hasOptionalEntry(String entryName, Object value) { + Matcher hasEntry = (Matcher) hasEntry(entryName, value); + Matcher entryMissing = (Matcher) not(hasKey(entryName)); + + return allOf(isA(java.util.Map.class), either(hasEntry).or(entryMissing)); + } } From 77a3f76d589b396e8943e87a39e6d9aab6355539 Mon Sep 17 00:00:00 2001 From: Michael Edgar Date: Wed, 16 Oct 2024 11:34:07 -0400 Subject: [PATCH 120/121] Remove invalid `content` from TCK simpleapi.yaml test resource Signed-off-by: Michael Edgar --- tck/src/main/resources/simpleapi.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tck/src/main/resources/simpleapi.yaml b/tck/src/main/resources/simpleapi.yaml index b38c11d3..91a2aa8b 100644 --- a/tck/src/main/resources/simpleapi.yaml +++ b/tck/src/main/resources/simpleapi.yaml @@ -200,7 +200,6 @@ components: delete: responses: '202': - content: [] description: Delete item parameters: - name: id From 6ddd1b1ebd85a0b804ad5ae0c06db1a2fe3f879a Mon Sep 17 00:00:00 2001 From: Eclipse MicroProfile bot Date: Tue, 22 Oct 2024 16:52:06 +0000 Subject: [PATCH 121/121] [maven-release-plugin] prepare release 4.0.2 --- api/pom.xml | 2 +- pom.xml | 4 ++-- spec/pom.xml | 2 +- spi/pom.xml | 2 +- tck/pom.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 7ff65f43..76b9800e 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.2 microprofile-openapi-api diff --git a/pom.xml b/pom.xml index eaaacce5..eeedc782 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.2 pom MicroProfile OpenAPI Eclipse MicroProfile OpenAPI @@ -58,7 +58,7 @@ https://github.com/eclipse/microprofile-open-api scm:git:https://github.com/eclipse/microprofile-open-api.git scm:git:git@github.com:eclipse/microprofile-open-api.git - 3.1-SNAPSHOT + 4.0.2 diff --git a/spec/pom.xml b/spec/pom.xml index 665ee21e..ec8f97de 100644 --- a/spec/pom.xml +++ b/spec/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.2 microprofile-openapi-spec diff --git a/spi/pom.xml b/spi/pom.xml index e0ffb757..fd0c4e7e 100644 --- a/spi/pom.xml +++ b/spi/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.2 microprofile-openapi-spi diff --git a/tck/pom.xml b/tck/pom.xml index 2725a8fa..f6e9e99a 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -20,7 +20,7 @@ org.eclipse.microprofile.openapi microprofile-openapi-parent - 4.1-SNAPSHOT + 4.0.2 microprofile-openapi-tck