Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.21.0
-
None
-
<spring-boot.version>1.5.10.RELEASE</spring-boot.version> <camel.version>2.21.0</camel.version> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-boot-starter</artifactId> <version>${camel.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-swagger-java-starter</artifactId> <version>${camel.version}</version> </dependency>
java -version openjdk version "1.8.0_162" OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
<spring-boot.version> 1.5.10.RELEASE </spring-boot.version> <camel.version> 2.21.0 </camel.version> <dependency> <groupId> org.apache.camel </groupId> <artifactId> camel-spring-boot-starter </artifactId> <version> ${camel.version} </version> </dependency> <dependency> <groupId> org.apache.camel </groupId> <artifactId> camel-swagger-java-starter </artifactId> <version> ${camel.version} </version> </dependency> java -version openjdk version "1.8.0_162" OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
-
Novice
Description
I've created two gists.
This first gist is generated by camel-swagger-java:2.21.0 and is broken
Copy the contents and paste into the Swagger Editor. See field identification under /classifier which according to the editor is broken.
[This second gist](https://gist.github.com/hochas/1218ef7a14da509f7079c1f5e098b53c) is modified by hand and displays the field identification as expected.
The difference is at line 74. The enum type in the broken version, line 76, should be inside the `items` object, according to this issue at swagger-ui.
This current behavior seems to have been correct some time back.
This is the related parameter that I am creating in my camel route using the DSL:
parameters.add(new RestOperationParamDefinition() .name("identification") .type(RestParamType.query) .required(true) .description("The types of identification to include") .allowableValues(IdentificationType.getAllTypes()) .collectionFormat(CollectionFormat.csv) .dataType("array") .arrayType("string"));
If it helps, here is the entirety of the route:
public class ClassifierRoute extends RouteBuilder { @Override public void configure() throws Exception { rest("/classifier") .description("MatchX Classifier REST API") .id("Classifier route") .get() .description("Gets classifiers based on supplied parameters") .produces(MediaType.APPLICATION_JSON) .outType(Identification.class) .responseMessage() .code(200) .message("Returns a result set in JSON format") .endResponseMessage() .responseMessage() .code(400) .message("The supplied query is invalid") .endResponseMessage() .params(addParameters()) .to("direct:algorithmMatch"); from("direct:algorithmMatch") .bean(ClassifierMediator.class, "getAlgorithmMatchCount") .marshal() .json(JsonLibrary.Jackson); } private List<RestOperationParamDefinition> addParameters() { List<RestOperationParamDefinition> parameters = Lists.newArrayList(); parameters.add(new RestOperationParamDefinition() .name("feature") .type(RestParamType.query) .required(false) .description("The classifier feature type.") .allowableValues(FeatureType.getAllTypes())); parameters.add(new RestOperationParamDefinition() .name("rating") .type(RestParamType.query) .required(true) .description("The rating of the associated classifier. Takes everything up to and including this number.") .allowableValues("0", "1", "2", "3", "4") .dataType("integer")); parameters.add(new RestOperationParamDefinition() .name("identification") .type(RestParamType.query) .required(true) .description("The types of identification to include") .allowableValues(IdentificationType.getAllTypes()) .collectionFormat(CollectionFormat.csv) .dataType("array") .arrayType("string")); parameters.add(new RestOperationParamDefinition() .name("from") .type(RestParamType.query) .required(true) .dataType("string") .dataFormat("date") .description("yyyy-MM-dd")); parameters.add(new RestOperationParamDefinition() .name("to") .type(RestParamType.query) .required(true) .dataType("string") .dataFormat("date") .description("yyyy-MM-dd")); return parameters; } }