This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 36bca9e Add support for descriptions and examples (#6117)
36bca9e is described below
commit 36bca9ea8b8824480301856ad55f242c4d161488
Author: Thorsten Roemer <[email protected]>
AuthorDate: Mon Sep 20 16:37:36 2021 +0200
Add support for descriptions and examples (#6117)
Add support for @Schema annotation parameters "description" and "example".
---
.../main/java/org/apache/camel/openapi/RestModelConverters.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestModelConverters.java
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestModelConverters.java
index db5ffb4..30dbe80 100644
---
a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestModelConverters.java
+++
b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestModelConverters.java
@@ -163,6 +163,15 @@ public class RestModelConverters {
model.required = new ArrayList<String>(schema.getRequired());
}
+ String description = schema.getDescription();
+ if (description != null) {
+ model.description = description;
+ }
+ Object example = schema.getExample();
+ if (example != null) {
+ model.example = example;
+ }
+
if (schema.getAdditionalProperties() instanceof Schema) {
OasSchema additionalProperties =
model.createAdditionalPropertiesSchema();
model.additionalProperties = additionalProperties;