Skip to content

Commit 20fa814

Browse files
committed
Clarify declarative OpenAPI fallback behavior
1 parent 20ab880 commit 20fa814

1 file changed

Lines changed: 28 additions & 16 deletions

File tree

  • openapi/openapi/src/main/java/io/helidon/openapi

openapi/openapi/src/main/java/io/helidon/openapi/OpenApi.java

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
/**
3030
* OpenAPI document annotations.
3131
* <p>
32-
* Declarative OpenAPI annotations do not model operation callbacks or top-level webhooks. Applications can contribute
33-
* these items using a static OpenAPI document or an {@link io.helidon.openapi.spi.OpenApiDocumentSource}; Helidon
34-
* composes those items with annotation-generated content.
32+
* Declarative OpenAPI annotations do not model operation callbacks or OpenAPI 3.1 and 3.2 top-level webhooks. To
33+
* describe a callback, use a static OpenAPI document or an {@link io.helidon.openapi.spi.OpenApiDocumentSource} that
34+
* defines the complete containing operation, and configure Helidon not to generate the same path and method from
35+
* annotations. A static document or document source can also define top-level webhooks. Combining static and generated
36+
* content uses {@link OpenApiGeneratedMode#MERGE MERGE} mode and requires non-conflicting content.
3537
*/
3638
@Api.Preview
3739
@Api.Since("27.0.0")
@@ -512,9 +514,11 @@ public enum Style {
512514
* Complete OpenAPI path template for this operation. This is useful when the Helidon route template cannot be
513515
* represented directly as an OpenAPI path. The value is not relative to the declarative HTTP path annotation.
514516
* <p>
515-
* This element configures only the path template; it does not configure Path Item Object metadata such as
516-
* {@code $ref}, summary, description, or path-level servers. Contribute such metadata using a static OpenAPI
517-
* document or an {@link io.helidon.openapi.spi.OpenApiDocumentSource}.
517+
* This element configures only the path template. Use a static OpenAPI document or an
518+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource} to define Path Item Object summary, description, or
519+
* path-level servers. If a Path Item {@code $ref} accompanies locally generated fields, the referenced Path Item
520+
* must not define any of the same fields; otherwise the static document or document source must own the complete
521+
* Path Item and Helidon must not also generate the same path and method from annotations.
518522
* <p>
519523
* Path overrides must start with {@code /} and must declare the same path parameters as the generated route.
520524
* Use simple OpenAPI path parameters such as {@code {id}}. Regex constraints, optional path segments, wildcards,
@@ -605,8 +609,10 @@ public enum Style {
605609
* locations are {@code path}, {@code query}, {@code header}, and {@code cookie}. Parameter-target usage cannot
606610
* override the generated parameter location.
607611
* <p>
608-
* Declarative OpenAPI annotations do not support OpenAPI 3.2 {@code querystring} parameters. Use a static OpenAPI
609-
* document or an {@link io.helidon.openapi.spi.OpenApiDocumentSource} to contribute such parameters.
612+
* Declarative OpenAPI annotations do not support OpenAPI 3.2 {@code querystring} parameters. To use one, define
613+
* the complete containing operation in a static OpenAPI document or an
614+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource}, and configure Helidon not to generate the same path and
615+
* method from annotations.
610616
*
611617
* @return location
612618
*/
@@ -761,9 +767,10 @@ public enum Style {
761767
/**
762768
* HTTP status code in the range {@code 100..599}. A method can declare at most one response for each status.
763769
* <p>
764-
* This element supports exact status codes only. Use a static OpenAPI document or an
765-
* {@link io.helidon.openapi.spi.OpenApiDocumentSource} to declare {@code default} or a wildcard response range
766-
* ({@code 1XX} through {@code 5XX}).
770+
* This element supports exact status codes only. To declare {@code default} or a wildcard response range
771+
* ({@code 1XX} through {@code 5XX}), define the complete containing operation in a static OpenAPI document or an
772+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource}, and configure Helidon not to generate the same path and
773+
* method from annotations.
767774
*
768775
* @return status code
769776
*/
@@ -892,8 +899,9 @@ public enum Style {
892899
* OpenAPI Header Object metadata.
893900
* <p>
894901
* Declarative OpenAPI annotations do not model Header Object {@code example}, {@code examples}, or {@code explode}
895-
* metadata. Use a static OpenAPI document or an {@link io.helidon.openapi.spi.OpenApiDocumentSource} to contribute
896-
* such metadata.
902+
* metadata. To use such metadata, define the complete containing operation in a static OpenAPI document or an
903+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource}, and configure Helidon not to generate the same path and
904+
* method from annotations.
897905
*/
898906
@Target({})
899907
@Retention(RetentionPolicy.CLASS)
@@ -964,8 +972,10 @@ public enum Style {
964972
* OpenAPI Media Type Object metadata.
965973
* <p>
966974
* Declarative OpenAPI annotations do not model {@code encoding} metadata, including per-part content types and
967-
* headers, or OpenAPI 3.2 {@code prefixEncoding} and {@code itemEncoding}. Use a static OpenAPI document or an
968-
* {@link io.helidon.openapi.spi.OpenApiDocumentSource} to contribute such metadata.
975+
* headers, or OpenAPI 3.2 {@code prefixEncoding} and {@code itemEncoding}. To use such metadata, define the complete
976+
* containing operation in a static OpenAPI document or an
977+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource}, and configure Helidon not to generate the same path and
978+
* method from annotations.
969979
*/
970980
@Target({})
971981
@Retention(RetentionPolicy.CLASS)
@@ -1095,7 +1105,9 @@ public enum Style {
10951105
* <p>
10961106
* Declarative OpenAPI annotations do not apply extensions to other OpenAPI objects, including servers, responses,
10971107
* headers, and links. Use a static OpenAPI document or an
1098-
* {@link io.helidon.openapi.spi.OpenApiDocumentSource} to contribute such extensions.
1108+
* {@link io.helidon.openapi.spi.OpenApiDocumentSource} to define such extensions. If the extended object belongs to
1109+
* an operation, the static document or document source must own the complete operation and Helidon must not also
1110+
* generate the same path and method from annotations.
10991111
*/
11001112
@Target({ElementType.TYPE, ElementType.METHOD})
11011113
@Retention(RetentionPolicy.CLASS)

0 commit comments

Comments
 (0)