1 package io.swagger.v3.oas.annotations.servers;
2
3 import io.swagger.v3.oas.annotations.extensions.Extension;
4
5 import java.lang.annotation.Inherited;
6 import java.lang.annotation.Repeatable;
7 import java.lang.annotation.Retention;
8 import java.lang.annotation.RetentionPolicy;
9 import java.lang.annotation.Target;
10
11 import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
12 import static java.lang.annotation.ElementType.TYPE;
13 import static java.lang.annotation.ElementType.METHOD;
14
15 /**
16  * The annotation may be applied at class or method level, or in {@link io.swagger.v3.oas.annotations.Operation#servers()} to define servers for the
17  * single operation (when applied at method level) or for all operations of a class (when applied at class level).
18  * <p>It can also be used in {@link io.swagger.v3.oas.annotations.OpenAPIDefinition#servers()} to define spec level servers.</p>
19  *
20  * @see <a target="_new" href="https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#serverObject">Server (OpenAPI specification)</a>
21  * @see io.swagger.v3.oas.annotations.OpenAPIDefinition
22  * @see io.swagger.v3.oas.annotations.Operation
23  **/

24 @Target({METHOD, TYPE, ANNOTATION_TYPE})
25 @Retention(RetentionPolicy.RUNTIME)
26 @Repeatable(Servers.class)
27 @Inherited
28 public @interface Server {
29     /**
30      * Required. A URL to the target host.
31      * This URL supports Server Variables and may be relative, to indicate that the host location is relative to the location where the
32      * OpenAPI definition is being served. Variable substitutions will be made when a variable is named in {brackets}.
33      *
34      * @return String url
35      **/

36     String url() default "";
37
38     /**
39      * An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text representation.
40      *
41      * @return String description
42      **/

43     String description() default "";
44
45     /**
46      * An array of variables used for substitution in the server's URL template.
47      *
48      * @return array of ServerVariables
49      **/

50     ServerVariable[] variables() default {};
51
52     /**
53      * The list of optional extensions
54      *
55      * @return an optional array of extensions
56      */

57     Extension[] extensions() default {};
58
59 }
60