I am new to swagger and found there are two packages for swagger annotation: io.swagger.annotations and com.wordnik.swagger.annotations. I wonder what the difference is between them and what I should use?
Annotation Type Api. @Target(value=TYPE) @Retention(value=RUNTIME) @Inherited public @interface Api. Marks a class as a Swagger resource. By default, Swagger-Core will only include and introspect only classes that are annotated with @Api and will ignore other resources (JAX-RS endpoints, Servlets and so on).
The annotation may be used to define a Schema for a set of elements of the OpenAPI spec, and/or to define additional properties for the schema. It is applicable e.g. to parameters, schema classes (aka "models"), properties of such models, request and response content, header.
Describes an operation or typically a HTTP method against a specific path. Operations with equivalent paths are grouped in a single Operation Object. A combination of a HTTP method and a path creates a unique operation.
The com.wordnik
package is for the older swagger specifications, 1.x. As of swagger specification 2.0, the package is now io.swagger
. The annotation signatures should be the same, just the package has changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With