1 /**
2 * Copyright 2017 SmartBear Software
3 * <p>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * <p>
8 * http://www.apache.org/licenses/LICENSE-2.0
9 * <p>
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package io.swagger.v3.oas.annotations.media;
18
19 import io.swagger.v3.oas.annotations.extensions.Extension;
20
21 import java.lang.annotation.ElementType;
22 import java.lang.annotation.Inherited;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26
27 /**
28 * The annotation may be used to add one or more examples to the definition of a parameter, request or response content,
29 * by defining it as field {@link io.swagger.v3.oas.annotations.Parameter#examples()} or {@link Content#examples()}
30 *
31 * @see <a target="_new" href="https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#exampleObject">Example (OpenAPI specification)</a>
32 **/
33 @Target({ElementType.ANNOTATION_TYPE})
34 @Retention(RetentionPolicy.RUNTIME)
35 @Inherited
36 public @interface ExampleObject {
37 /**
38 * A unique name to identify this particular example
39 *
40 * @return the name of the example
41 **/
42 String name() default "";
43
44 /**
45 * A brief summary of the purpose or context of the example
46 *
47 * @return a summary of the example
48 **/
49 String summary() default "";
50
51 /**
52 * A string representation of the example. This is mutually exclusive with the externalValue property, and ignored if the externalValue property is specified. If the media type associated with the example allows parsing into an object, it may be converted from a string
53 *
54 * @return the value of the example
55 **/
56 String value() default "";
57
58 /**
59 * A URL to point to an external document to be used as an example. This is mutually exclusive with the value property.
60 *
61 * @return an external URL of the example
62 **/
63 String externalValue() default "";
64
65 /**
66 * The list of optional extensions
67 *
68 * @return an optional array of extensions
69 */
70 Extension[] extensions() default {};
71
72 /**
73 * A reference to a example defined in components examples.
74 *
75 * @since 2.0.3
76 * @return the reference
77 **/
78 String ref() default "";
79
80 /**
81 * A description of the purpose or context of the example
82 *
83 * @since 2.1.0
84 * @return a description of the example
85 **/
86 String description() default "";
87
88 }
89