Annotation Interface Server
@Target({TYPE,METHOD})
@Retention(RUNTIME)
@Repeatable(Servers.class)
@Inherited
public @interface Server
This annotation represents a Server used in an operation or used by all operations in an OpenAPI document.
When a Server annotation appears on a method the server is added to the corresponding OpenAPI operation servers field.
When a Server annotation appears on a type then the server is added to all the operations defined in that type except for those operations which already have one or more servers defined. The server is also added to the servers defined in the root level of the OpenAPI document.
This annotation is Repeatable
.
Note: If both Server
and
Servers
annotation are specified on the same
type, the server definitions will be combined.
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionAn optional string describing the host designated by the URL.A URL to the target host.An array of variables used for substitution in the server's URL template.
-
Element Details
-
url
String urlA URL to the target host. This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the OpenAPI definition is being served. Variable substitutions will be made when a variable is named in {brackets}. This is a REQUIRED property.- Returns:
- URL to the target host
- Default:
- ""
-
description
String descriptionAn optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.- Returns:
- description of the host designated by URL
- Default:
- ""
-
variables
ServerVariable[] variablesAn array of variables used for substitution in the server's URL template.- Returns:
- array of variables
- Default:
- {}
-