The problem is that api-docs
is being generated when I don't add .type()
and .outType()
but the format of the post request is not there. After adding them just like in the below statement api-docs
is not being generated when I hit http://localhost:8080/api-docs
URL.
rest("/accor") .post("/hotel/details") .consumes("application/json") .type(SearchParam.class) .outType(SearchParam.class) .to(URI);
My Camel configuration is as shown below:
private RestConfiguration createRestConfiguration(CamelContext camelContext) throws Exception { RestConfiguration restConfiguration = new RestConfiguration(); return new RestConfigurationDefinition() .component("jetty") .scheme(serverConfiguration.getScheme()) .host(serverConfiguration.getHost()) .port(serverConfiguration.getPort()) .bindingMode(RestBindingMode.off) .enableCORS(true) .apiContextPath("/api-docs") // Swagger API docs path .apiProperty("api.title", "ACCOR Rest API") .apiProperty("api.version", "1.0") .asRestConfiguration(camelContext, restConfiguration);}
I am attaching the images of the api-docs
in both the scenarios.
Below images is when I have added the lines for the output format.
This image is when I have added the lines for the output format
This image is when I removed those lines
Below I have added in the pom.xml
file for Swagger.
<dependency><groupId>org.apache.camel</groupId><artifactId>camel-openapi-java</artifactId><version>${camel.version}</version> <!-- Replace with your Camel version --></dependency>
I am using Spring Boot 2 and OpenAPI version 3.14.