Versions Compared

Key

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

Swagger Scala Component (deprecated)

Available as of Camel 2.14

The  Rest DSL can be integrated with the camel-swagger module which is used for exposing the REST services and their APIs using Swagger.

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

Warning

This component is deprecated. From Camel 2.16 onwards use the new Java based swagger module Swagger Java

The 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 default servlet supports any environment using JMX to discover the CamelContext(s) to use.

...

Notice this is a very simple CORS filter. You may need to use a more sophisticated filter to set the header values differently for a given client. Or block certain clients etc.

Multiple CamelContexts

Available as of Camel 2.16

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