Breadcrumbs

Swagger 2

This page lists all supported Swagger 2 elements and rules.

Supported REST Service Elements And Rules

Services are defined using the following elements:

Element

Supported
by
Connector

Description

More Information at ...

swagger

check mark

Specifies the Swagger specification version being used. The importer only supports Swagger 2.0.


info

check mark

Provides metadata about the API.



title

check mark

The title is used as name for the REST interface.


description

check mark

The description is used as documentation for the REST interface.


host

check mark

The host (name or IP) serving the API. This must be the host only and does not include the scheme nor sub-paths. It may include a port, though. host and port are set in the REST alias.


basePath

check mark

The base path on which the API is served. basePath is relative to the host. If it is not included, the API is served directly under host. The basePath is set in the REST alias.


schemes

check mark

A list of transfer protocols of the API. The first scheme is set as protocol in the REST alias.

The REST adapter only supports HTTP and HTTPS.


consumes

cross mark

A list of MIME types the APIs can consume.

The REST adapter only parses JSON and XML.


produces

cross mark

A list of MIME types the APIs can produce.

The REST adapter only parses JSON and XML .


paths

check mark

The available paths and operations for the API. REST resource classes are created to reproduce each paths structure.



$ref

cross mark

Allows for an external definition of this path item.


methods

check mark

The http methods defined for this path. A REST operation is created for each methods.



tags

check mark

A list of tags for API documentation control. A usage is created from the operation to the corresponding RESTOperationTag for each tag.


summary

check mark

A short summary of what the operation does. If the description if empty, the summary is used as documentation for the operation.


description

check mark

A verbose explanation of the operation behavior. The description is used as documentation for the operation.


externalDocs

cross mark

Additional external documentation for this operation.


operationId

cross mark

Unique string used to identify the operation.


consumes

check mark

A list of MIME types the operation can consume. As the REST adapter only support JSON and XML if consumes is defined and none of these are in the list the parameters are ignored.


produces

check mark

A list of MIME types the operation can produce. As the REST adapter only support JSON and XML if produces is defined and none of these are in the list the responses are ignored.


parameters

check mark

A list of parameters of parameter reference that are applicable for this operation. A REST parameter is created for each parameter object.

Parameter Object

responses


check mark

The list of possible responses as they are returned from executing this operation. An output parameter is created for the default response status code (201 for POST, 200 for the others). If the status code is < 400 or default, the RESTResponse stereotype is added to the class. If the status code is >= 400 or default the RESTError stereotype is added to the class.


description

check mark

A short description of the response. The description is used as a documentation for the parameter or the usage.


schema

check mark

A definition or definition reference of the response structure.

The adapter does not support primitives as response therefore a responses of these types are ignored.

Schema Object

headers

cross mark

A list of headers that are sent with the response.


examples

cross mark

An example of the response message.


schemes

cross mark

The transfer protocol for the operation.


deprecated

cross mark

Declares this operation to be deprecated. 


security

cross mark

A declaration of which security schemes are applied to this operation.


parameters

cross mark

A list of parameters that are applicable to all the operations described under this path.


definitions

check mark

A list to hold data types produced and consumed by operations. A class is created for each schema object.

Schema Object

parameters

check mark

A list to hold parameters that can be used across operations.

Parameter Object

responses

cross mark

An list to hold responses that can be used across operations.


securityDefinitions

cross mark

Security scheme definitions that can be used across the specification.


security

cross mark

A declaration of which security schemes are applied for the API as a whole.


tags

check mark

A list of tags used by the specification with additional metadata. A RESTOperationTag class is created for each tag definition.



name

check mark

The name of the tag is used as name for the class.


description

check mark

A short description for the tag. The description is used as documentation for the operation.


externalDocs

check mark

Additional external documentation for this tag. The external documentation is set to the tagged values of the RESTOperationTag.


externalDocs

cross mark

Additional external documentation. 


Supported REST Parameter Elements And Rules

Parameter objects can be defined inline or be a reference to a parameter of the parameters list.

Element

Supported
By
Connector

Description

More Information at ...

name

check mark

The name of the parameter. Parameter names are case sensitive.

  • If in is "path", the name field must correspond to the associated path segment from the path.

  • For all other cases, the name corresponds to the parameter name based on the in property.

See Path Templating for further information.

in

( check mark )

The location of the parameter. Possible values are "query", "header", "path" or "body".

"formData" is not supported by the importer and ignored.


description

cross mark

A brief description of the parameter


required

check mark

Determines whether this parameter is mandatory. If true, the multiplicity of the parameter is set to 1, else it is set to 0..1.


schema

check mark

If in is "body", schema defines the type used for the body parameter.

Schema Object

type

check mark

if in is other than "body", type defines the type of the parameter.

  • integer: the base type Integer is used.

  • number: the base type Float is used.

  • boolean: the base type Boolean is used.

  • string: the type depends on the format.

    • byte: the base type Blob is used.

    • date-time: the base type DateTime is used.

    • otherwise the base type String is used.

  • array: the parameter will get the E2EArray stereotype and the class of items is used as arrayElement.

If type is not given at all, and the definition has no properties, it will be imported as urn:Base Types.Any.


format

check mark

 The format of the object is used to be more specific when the type is string.


items

check mark

 The item is a schema object to define the type of element in the array. Only used if type is array.

 Schema Object

Supported REST Schema Elements And Rules

Schema objects can be defined inline or be a reference to an object of the definitions list. The following rules apply for schema objects:

  • A class is created for each schema object that is not a base type or array.

  • If the schema object is in the definitions list, the key is used as class name.

  • In all other cases, a unique name is created using the path to the schema object (E.g.: "UserList_Items", "users_GET_response" ...).

Element

Supported
By Connector

Description

More Information at ...

$ref

check mark

A reference to a schema defined in the definitions list. the schema object is replaced by the definition.


type

check mark

The type of the object.

  • integer: base type Integer is used.

  • number: base type Float is used.

  • boolean: base type Boolean is used.

  • string: type depends on the format.

    • byte: base type Blob is used.

    • date-time: base type DateTime is used.

    • otherwise base type String is used.

  • array: if used as type of a parameter the parameter will get the E2EArray stereotype and the class of items is used as arrayElement. If used as type of a property, the class of items is used and the multiplicity is set to 0..*.

  • object: A class is created and properties are created regarding the allOf and properties values.

If type is not given at all, and the definition has no properties, it will be imported as urn:Base Types.Any.


format

check mark

The format of the object is used to be more specific when the type is string.


items

check mark

The item is a schema object to defined the type of element in the array. Only used if type is array.


allOf

check mark

List of schema object. The resulting class will contain all properties of all listed schema objects.


properties

check mark

List of properties. Each property is define by a name and a schema object. A property is created on the resulting class for each properties defined.


additionalProperties

cross mark

This should allow to define a map/dictionary.


xml

cross mark

Adds additional metadata to describe the XML representation format of this property.


Related Documentation: