Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Swagger Scala Component (deprecated)

Available as of Camel 2.14

...

Maven users will need to add the following dependency to their pom.xml for this component:From 

Warning

This component is deprecated. From Camel 2.16 onwards use the

...

new Java based swagger module Swagger Java

The

Code Block
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-swagger-java</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

And the old Scala based camel-swagger module is deprecated, and to be removed in a future release.

Code Block
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-swagger</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Using with Camel 2.

...

15.x

The name of the servlet is org.apache.camel.swagger.servlet.RestSwaggerServlet.

However some of the Camel components is able to support Swagger API documentation out of the box without having to use a servlet container. For example these components: JettyNetty HTTPNetty HTTPUndertow. This allows to provide Swagger API in standalone containers that has no servlet container. For an example see the camel-example-swagger-cdi in the examples directory of the Apache Camel distribution.

Using with Camel 2.15 onwards

The default servlet supports any environment using JMX to discover the CamelContext(s) to use.

...

When using camel-swagger from Camel 2.16 onwards then it supports detecting all the running CamelContexts in the same JVM. These contexts are listed in the root path, eg `/api-docs` as a simple list of names in json format. To access the swagger documentation then the context-path must be appended with the Camel context id, such as `api-docs/myCamel`.

 

Examples

In the Apache Camel distribution we ship the camel-example-servlet-rest-tomcat which demonstrates using this Swagger component.

See Also