|
26 | 26 |
|
27 | 27 | import java.lang.annotation.Annotation;
|
28 | 28 |
|
| 29 | +import io.swagger.v3.oas.annotations.enums.Explode; |
29 | 30 | import io.swagger.v3.oas.annotations.headers.Header;
|
| 31 | +import io.swagger.v3.oas.annotations.media.ArraySchema; |
| 32 | +import io.swagger.v3.oas.annotations.media.ExampleObject; |
30 | 33 | import io.swagger.v3.oas.annotations.media.Schema;
|
31 | 34 |
|
32 | 35 | /**
|
33 | 36 | * The type Header builder.
|
| 37 | + * |
34 | 38 | * @author bnasslahsen
|
35 | 39 | */
|
36 | 40 | public class Builder {
|
37 | 41 |
|
38 | 42 | /**
|
39 | 43 | * Required: The name of the header. The name is only used as the key to store this header in a map.
|
40 |
| - * |
41 | 44 | */
|
42 | 45 | private String name;
|
43 | 46 |
|
44 | 47 | /**
|
45 | 48 | * Additional description data to provide on the purpose of the header
|
46 |
| - * |
47 | 49 | */
|
48 | 50 | private String description = "";
|
49 | 51 |
|
50 | 52 | /**
|
51 | 53 | * The schema defining the type used for the header. Ignored if the properties content or array are specified.
|
52 |
| - * |
53 | 54 | */
|
54 | 55 | private Schema schema = org.springdoc.core.fn.builders.schema.Builder.schemaBuilder().build();
|
55 | 56 |
|
56 | 57 | /**
|
57 | 58 | * Determines whether this header is mandatory. The property may be included and its default value is false.
|
58 |
| - * |
59 | 59 | */
|
60 | 60 | private boolean required;
|
61 | 61 |
|
62 | 62 | /**
|
63 | 63 | * Specifies that a header is deprecated and should be transitioned out of usage.
|
64 |
| - * |
65 | 64 | */
|
66 | 65 | private boolean deprecated;
|
67 | 66 |
|
68 | 67 | /**
|
69 | 68 | * A reference to a header defined in components headers.
|
| 69 | + * |
70 | 70 | * @since swagger -core 2.0.3
|
71 | 71 | */
|
72 | 72 | private String ref = "";
|
73 | 73 |
|
| 74 | + /** |
| 75 | + * The Explode. |
| 76 | + */ |
| 77 | + private Explode explode = Explode.DEFAULT; |
| 78 | + |
| 79 | + /** |
| 80 | + * The Hidden. |
| 81 | + */ |
| 82 | + private boolean hidden; |
| 83 | + |
| 84 | + /** |
| 85 | + * The Example. |
| 86 | + */ |
| 87 | + private String example = ""; |
| 88 | + |
| 89 | + /** |
| 90 | + * The Examples. |
| 91 | + */ |
| 92 | + private ExampleObject[] examples = {}; |
| 93 | + |
| 94 | + /** |
| 95 | + * Array array schema. |
| 96 | + */ |
| 97 | + private ArraySchema array = org.springdoc.core.fn.builders.arrayschema.Builder.arraySchemaBuilder().build(); |
| 98 | + |
74 | 99 | /**
|
75 | 100 | * Instantiates a new Header builder.
|
76 | 101 | */
|
@@ -152,6 +177,50 @@ public Builder ref(String ref) {
|
152 | 177 | return this;
|
153 | 178 | }
|
154 | 179 |
|
| 180 | + /** |
| 181 | + * Explode builder. |
| 182 | + * |
| 183 | + * @param val the val |
| 184 | + * @return the builder |
| 185 | + */ |
| 186 | + public Builder explode(Explode val) { |
| 187 | + explode = val; |
| 188 | + return this; |
| 189 | + } |
| 190 | + |
| 191 | + /** |
| 192 | + * Hidden builder. |
| 193 | + * |
| 194 | + * @param val the val |
| 195 | + * @return the builder |
| 196 | + */ |
| 197 | + public Builder hidden(boolean val) { |
| 198 | + hidden = val; |
| 199 | + return this; |
| 200 | + } |
| 201 | + |
| 202 | + /** |
| 203 | + * Example builder. |
| 204 | + * |
| 205 | + * @param val the val |
| 206 | + * @return the builder |
| 207 | + */ |
| 208 | + public Builder example(String val) { |
| 209 | + example = val; |
| 210 | + return this; |
| 211 | + } |
| 212 | + |
| 213 | + /** |
| 214 | + * Examples builder. |
| 215 | + * |
| 216 | + * @param val the val |
| 217 | + * @return the builder |
| 218 | + */ |
| 219 | + public Builder examples(ExampleObject[] val) { |
| 220 | + examples = val; |
| 221 | + return this; |
| 222 | + } |
| 223 | + |
155 | 224 | /**
|
156 | 225 | * Build header.
|
157 | 226 | *
|
@@ -194,6 +263,31 @@ public boolean deprecated() {
|
194 | 263 | public String ref() {
|
195 | 264 | return ref;
|
196 | 265 | }
|
| 266 | + |
| 267 | + @Override |
| 268 | + public Explode explode() { |
| 269 | + return explode; |
| 270 | + } |
| 271 | + |
| 272 | + @Override |
| 273 | + public boolean hidden() { |
| 274 | + return hidden; |
| 275 | + } |
| 276 | + |
| 277 | + @Override |
| 278 | + public String example() { |
| 279 | + return example; |
| 280 | + } |
| 281 | + |
| 282 | + @Override |
| 283 | + public ExampleObject[] examples() { |
| 284 | + return examples; |
| 285 | + } |
| 286 | + |
| 287 | + @Override |
| 288 | + public ArraySchema array() { |
| 289 | + return array; |
| 290 | + } |
197 | 291 | };
|
198 | 292 | }
|
199 | 293 | }
|
|
0 commit comments