/
Schema.java
1185 lines (1049 loc) · 39.8 KB
/
Schema.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright 2017 SmartBear Software
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.microprofile.openapi.models.media;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.eclipse.microprofile.openapi.models.Constructible;
import org.eclipse.microprofile.openapi.models.Extensible;
import org.eclipse.microprofile.openapi.models.ExternalDocumentation;
import org.eclipse.microprofile.openapi.models.Reference;
/**
* The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is
* an extended subset of the <a href="https://tools.ietf.org/html/draft-wright-json-schema-00">JSON Schema Specification Wright Draft 00</a>.
* <p>
* For more information about the properties, see <a href="http://json-schema.org/">JSON Schema Core</a> and
* <a href= "https://tools.ietf.org/html/draft-wright-json-schema-validation-00">JSON Schema Validation</a>. Unless stated otherwise, the property
* definitions follow the JSON Schema.
* <p>
* Any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing an existing definition instead of
* defining the same Schema again.
*
* @see <a href= "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject">OpenAPI Specification Schema Object</a>
*/
public interface Schema extends Extensible<Schema>, Constructible, Reference<Schema> {
/**
* The values allowed for the in field.
*/
enum SchemaType {
INTEGER("integer"), NUMBER("number"), BOOLEAN("boolean"),
STRING("string"), OBJECT("object"), ARRAY("array");
private final String value;
SchemaType(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
/**
* Returns the discriminator property from this Schema instance.
*
* @return the discriminator that is used to differentiate between the schemas which may satisfy the payload description
**/
Discriminator getDiscriminator();
/**
* Sets the discriminator property of this Schema instance to the given object.
*
* @param discriminator the object that is used to differentiate between the schemas which may satisfy the payload description
*/
void setDiscriminator(Discriminator discriminator);
/**
* Sets the discriminator property of this Schema instance to the given object.
*
* @param discriminator the object that is used to differentiate between the schemas which may satisfy the payload description
* @return the current Schema instance
*/
default Schema discriminator(Discriminator discriminator) {
setDiscriminator(discriminator);
return this;
}
/**
* Returns the title property from this Schema instance.
*
* @return the title assigned to this Schema
**/
String getTitle();
/**
* Sets the title property of this Schema instance to the given string.
*
* @param title a title to assign to this Schema
*/
void setTitle(String title);
/**
* Sets the title property of this Schema instance to the given string.
*
* @param title a title to assign to this Schema
* @return the current Schema instance
*/
default Schema title(String title) {
setTitle(title);
return this;
}
/**
* Returns the default value property from this Schema instance.
*
* @return the default value object
**/
Object getDefaultValue();
/**
* Set the default value property of this Schema instance to the value given.
*
* @param defaultValue a value to use as the default
*/
void setDefaultValue(Object defaultValue);
/**
* Set the default value property of this Schema instance to the value given.
*
* @param defaultValue a value to use as the default
* @return the current Schema instance
*/
default Schema defaultValue(Object defaultValue) {
setDefaultValue(defaultValue);
return this;
}
/**
* Returns the enumerated list of values allowed for objects defined by this Schema.
*
* @return the list of values allowed for objects defined by this Schema
*/
List<Object> getEnumeration();
/**
* Sets the enumerated list of values allowed for objects defined by this Schema.
*
* @param enumeration a list of values allowed
*/
void setEnumeration(List<Object> enumeration);
default Schema enumeration(List<Object> enumeration) {
setEnumeration(enumeration);
return this;
}
/**
* Adds an item of the appropriate type to the enumerated list of values allowed.
*
* @param enumeration an object to add to the enumerated values
* @return current Schema instance
*/
Schema addEnumeration(Object enumeration);
/**
* Removes an item of the appropriate type to the enumerated list of values allowed.
*
* @param enumeration an object to add to the enumerated values
*/
void removeEnumeration(Object enumeration);
/**
* Returns the multipleOf property from this Schema instance.
* <p>
* minimum: 0
*
* @return the positive number that restricts the value of the object
**/
BigDecimal getMultipleOf();
/**
* Sets the multipleOf property of this Schema instance to the value given.
*
* @param multipleOf a positive number that restricts the value of objects described by this Schema
*/
void setMultipleOf(BigDecimal multipleOf);
/**
* Sets the multipleOf property of this Schema instance to the value given.
*
* @param multipleOf a positive number that restricts the value of objects described by this Schema
* @return the current Schema instance
*/
default Schema multipleOf(BigDecimal multipleOf) {
setMultipleOf(multipleOf);
return this;
}
/**
* Returns the maximum property from this Schema instance.
*
* @return the maximum value of a numeric object
**/
BigDecimal getMaximum();
/**
* Sets the maximum property of this Schema instance to the value given.
*
* @param maximum specifies the maximum numeric value of objects defined by this Schema
*/
void setMaximum(BigDecimal maximum);
/**
* Sets the maximum property of this Schema instance to the value given.
*
* @param maximum specifies the maximum numeric value of objects defined by this Schema
* @return the current Schema instance
*/
default Schema maximum(BigDecimal maximum) {
setMaximum(maximum);
return this;
}
/**
* Returns the exclusiveMaximum property from this Schema instance.
*
* @return whether the numeric value of objects must be less than the maximum property
**/
Boolean getExclusiveMaximum();
/**
* Sets the exclusiveMaximum property of this Schema instance to the value given.
*
* @param exclusiveMaximum when true the numeric value of objects defined by this Schema must be less than indicated by the maximum property
*/
void setExclusiveMaximum(Boolean exclusiveMaximum);
/**
* Sets the exclusiveMaximum property of this Schema instance to the value given.
*
* @param exclusiveMaximum when true the numeric value of objects defined by this Schema must be less than indicated by the maximum property
* @return the current Schema instance
*/
default Schema exclusiveMaximum(Boolean exclusiveMaximum) {
setExclusiveMaximum(exclusiveMaximum);
return this;
}
/**
* Returns the minimum property from this Schema instance.
*
* @return the minimum value of a numeric object
**/
BigDecimal getMinimum();
/**
* Sets the minimum property of this Schema instance to the value given.
*
* @param minimum specifies the minimum numeric value of objects defined by this Schema
*/
void setMinimum(BigDecimal minimum);
/**
* Sets the minimum property of this Schema instance to the value given.
*
* @param minimum specifies the minimum numeric value of objects defined by this Schema
* @return the current Schema instance
*/
default Schema minimum(BigDecimal minimum) {
setMinimum(minimum);
return this;
}
/**
* Returns the exclusiveMinimum property from this Schema instance.
*
* @return whether the numeric value of objects must be greater than the minimum property
**/
Boolean getExclusiveMinimum();
/**
* Sets the exclusiveMinimum property of this Schema instance to the value given.
*
* @param exclusiveMinimum when true the numeric value of objects defined by this Schema must be greater than indicated by the minimum property
*/
void setExclusiveMinimum(Boolean exclusiveMinimum);
/**
* Sets the exclusiveMinimum property of this Schema instance to the value given.
*
* @param exclusiveMinimum when true the numeric value of objects defined by this Schema must be greater than indicated by the minimum property
* @return the current Schema instance
*/
default Schema exclusiveMinimum(Boolean exclusiveMinimum) {
setExclusiveMinimum(exclusiveMinimum);
return this;
}
/**
* Returns the maxLength property from this Schema instance.
* <p>
* minimum: 0
*
* @return the maximum length of objects e.g. strings
**/
Integer getMaxLength();
/**
* Sets the maxLength property of this Schema instance to the value given.
*
* @param maxLength the maximum length of objects defined by this Schema
*/
void setMaxLength(Integer maxLength);
/**
* Sets the maxLength property of this Schema instance to the value given.
*
* @param maxLength the maximum length of objects defined by this Schema
* @return the current Schema instance
*/
default Schema maxLength(Integer maxLength) {
setMaxLength(maxLength);
return this;
}
/**
* Returns the minLength property from this Schema instance.
* <p>
* minimum: 0
*
* @return the minimum length of objects e.g. strings
**/
Integer getMinLength();
/**
* Sets the minLength property of this Schema instance to the value given.
*
* @param minLength the minimum length of objects defined by this Schema
*/
void setMinLength(Integer minLength);
/**
* Sets the minLength property of this Schema instance to the value given.
*
* @param minLength the minimum length of objects defined by this Schema
* @return the current Schema instance
*/
default Schema minLength(Integer minLength) {
setMinLength(minLength);
return this;
}
/**
* Returns the pattern property from this Schema instance.
*
* @return the regular expression which restricts the value of an object e.g. a string
**/
String getPattern();
/**
* Sets the pattern property of this Schema instance to the string given.
*
* @param pattern the regular expression which restricts objects defined by this Schema
*/
void setPattern(String pattern);
/**
* Sets the pattern property of this Schema instance to the string given.
*
* @param pattern the regular expression which restricts objects defined by this Schema
* @return the current Schema instance
*/
default Schema pattern(String pattern) {
setPattern(pattern);
return this;
}
/**
* Returns the maxItems property from this Schema instance.
* <p>
* minimum: 0
*
* @return the maximum number of elements in the object e.g. array elements
**/
Integer getMaxItems();
/**
* Sets the maxItems property of this Schema instance to the value given.
*
* @param maxItems the maximum number of elements in objects defined by this Schema e.g. array elements
*/
void setMaxItems(Integer maxItems);
/**
* Sets the maxItems property of this Schema instance to the value given.
*
* @param maxItems the maximum number of elements in objects defined by this Schema e.g. array elements
* @return the current Schema instance
*/
default Schema maxItems(Integer maxItems) {
setMaxItems(maxItems);
return this;
}
/**
* Returns the minItems property from this Schema instance.
* <p>
* minimum: 0
*
* @return the minimum number of elements in the object e.g. array elements
**/
Integer getMinItems();
/**
* Sets the minItems property of this Schema instance to the value given.
*
* @param minItems the minimum number of elements in objects defined by this Schema e.g. array elements
*/
void setMinItems(Integer minItems);
/**
* Sets the minItems property of this Schema instance to the value given.
*
* @param minItems the minimum number of elements in objects defined by this Schema e.g. array elements
* @return the current Schema instance
*/
default Schema minItems(Integer minItems) {
setMinItems(minItems);
return this;
}
/**
* Returns the uniqueItems property from this Schema instance.
*
* @return whether to ensure items are unique
**/
Boolean getUniqueItems();
/**
* Sets the uniqueItems property of this Schema instance to the value given.
*
* @param uniqueItems ensure the items (e.g. array elements) are unique in objects defined by this Schema
*/
void setUniqueItems(Boolean uniqueItems);
/**
* Sets the uniqueItems property of this Schema instance to the value given.
*
* @param uniqueItems ensure the items (e.g. array elements) are unique in objects defined by this Schema
* @return the current Schema instance
*/
default Schema uniqueItems(Boolean uniqueItems) {
setUniqueItems(uniqueItems);
return this;
}
/**
* Returns the maxProperties property from this Schema instance.
* <p>
* minimum: 0
*
* @return the maximum number of properties allowed in the object
**/
Integer getMaxProperties();
/**
* Sets the maxProperties property of this Schema instance to the value given.
*
* @param maxProperties limit the number of properties in objects defined by this Schema
*/
void setMaxProperties(Integer maxProperties);
/**
* Sets the maxProperties property of this Schema instance to the value given.
*
* @param maxProperties limit the number of properties in objects defined by this Schema
* @return the current Schema instance
*/
default Schema maxProperties(Integer maxProperties) {
setMaxProperties(maxProperties);
return this;
}
/**
* Returns the minProperties property from this Schema instance.
* <p>
* minimum: 0
*
* @return the minimum number of properties allowed in the object
**/
Integer getMinProperties();
/**
* Sets the minProperties property of this Schema instance to the value given.
*
* @param minProperties limit the number of properties in objects defined by this Schema
*/
void setMinProperties(Integer minProperties);
/**
* Sets the minProperties property of this Schema instance to the value given.
*
* @param minProperties limit the number of properties in objects defined by this Schema
* @return the current Schema instance
*/
default Schema minProperties(Integer minProperties) {
setMinProperties(minProperties);
return this;
}
/**
* Returns the required property from this Schema instance.
*
* @return the list of fields required in objects defined by this Schema
**/
List<String> getRequired();
/**
* Sets the list of fields required in objects defined by this Schema.
*
* @param required the list of fields required in objects defined by this Schema
*/
void setRequired(List<String> required);
/**
* Sets the list of fields required in objects defined by this Schema.
*
* @param required the list of fields required in objects defined by this Schema
* @return the current Schema instance
*/
default Schema required(List<String> required) {
setRequired(required);
return this;
}
/**
* Adds the name of an item to the list of fields required in objects defined by this Schema.
*
* @param required the name of an item required in objects defined by this Schema instance
* @return the current Schema instance
*/
Schema addRequired(String required);
/**
* Removes the name of an item to the list of fields required in objects defined by this Schema.
*
* @param required the name of an item required in objects defined by this Schema instance
*/
void removeRequired(String required);
/**
* Returns the type property from this Schema.
*
* @return the type used in this Schema. Default value <b>must</b> be <code>null</code>
**/
SchemaType getType();
/**
* Sets the type used by this Schema to the string given.
*
* @param type the type used by this Schema or <code>null</code> for
* reference schemas
*/
void setType(SchemaType type);
/**
* Sets the type used by this Schema to the string given.
*
* @param type the type used by this Schema or <code>null</code> for
* reference schemas
* @return the current Schema instance
*/
default Schema type(SchemaType type) {
setType(type);
return this;
}
/**
* Returns a Schema which describes properties not allowed in objects defined by the current schema.
*
* @return the not property's schema
**/
Schema getNot();
/**
* Sets the not property to a Schema which describes properties not allowed in objects defined by the current schema.
*
* @param not the Schema which describes properties not allowed
*/
void setNot(Schema not);
/**
* Sets the not property to a Schema which describes properties not allowed in objects defined by the current schema.
*
* @param not the Schema which describes properties not allowed
* @return the current Schema instance
*/
default Schema not(Schema not) {
setNot(not);
return this;
}
/**
* Returns the properties defined in this Schema.
*
* @return a map which associates property names with the schemas that describe their contents
**/
Map<String, Schema> getProperties();
/**
* Sets the properties of this Schema instance to the map provided.
*
* @param properties a map which associates property names with the schemas that describe their contents
*/
void setProperties(Map<String, Schema> properties);
/**
* Sets the properties of this Schema instance to the map provided.
*
* @param properties a map which associates property names with the schemas that describe their contents
* @return the current Schema instance
*/
default Schema properties(Map<String, Schema> properties) {
setProperties(properties);
return this;
}
/**
* Adds a Schema property of the provided name using the given schema.
*
* @param key the name of a new Schema property
* @param propertySchema the Schema which describes the properties of the named property. null values will be rejected (implementation will throw
* an exception) or ignored.
* @return the current Schema instance
*/
Schema addProperty(String key, Schema propertySchema);
/**
* Removes a Schema property of the provided name using the given schema.
*
* @param key the name of a new Schema property
*/
void removeProperty(String key);
/**
* Returns the value of the "additionalProperties" setting, which indicates whether
* properties not otherwise defined are allowed. This setting MUST either be a {@link Boolean}
* or {@link Schema}, they can not be set both at the same time.
*
* <ul>
* <li>If "additionalProperties" is true, then any additional properties are allowed.</li>
*
* <li>If "additionalProperties" is false, then only properties covered by the "properties"
* and "patternProperties" are allowed.</li>
*
* <li>If "additionalProperties" is a Schema, then additional properties are allowed but
* should conform to the Schema.</li>
* </ul>
* @deprecated since 1.1, use @link {@link #getAdditionalPropertiesSchema()} or {@link #getAdditionalPropertiesBoolean()} instead
* @return a Boolean or a schema
*/
@Deprecated
default Object getAdditionalProperties() {
Schema s = getAdditionalPropertiesSchema();
if(s != null) {
return s;
}
return getAdditionalPropertiesBoolean();
}
/**
* Returns the value of the "additionalProperties" setting, which indicates whether
* properties not otherwise defined are allowed. This setting MUST either be a {@link Boolean}
* or {@link Schema}, they can not be set both at the same time.
* <p>
* This method returns a {@link Schema}, for the {@link Boolean} getter use {@link #getAdditionalPropertiesBoolean()}
* <ul>
* <li>If "additionalProperties" is a Schema, then additional properties are allowed but
* should conform to the Schema.</li>
* </ul>
* @return this Schema's additionalProperties property (as {@link Schema})
*/
Schema getAdditionalPropertiesSchema();
/**
* Returns the value of the "additionalProperties" setting, which indicates whether
* properties not otherwise defined are allowed. This setting MUST either be a {@link Boolean}
* or {@link Schema}, they can not be set both at the same time.
* <p>
* This method returns a {@link Boolean}, for the {@link Schema} getter use {@link #getAdditionalPropertiesSchema()}
* <ul>
* <li>If "additionalProperties" is true, then any additional properties are allowed.</li>
*
* <li>If "additionalProperties" is false, then only properties covered by the "properties"
* and "patternProperties" are allowed.</li>
* </ul>
* @return this Schema's additionalProperties property (as {@link Boolean})
*/
Boolean getAdditionalPropertiesBoolean();
/**
* Sets the Schema which defines additional properties not defined by "properties" or "patternProperties".
* See the javadoc for {@link Schema#getAdditionalPropertiesSchema()} for more details on this setting. Note
* that this version of the setter is mutually exclusive with the {@link Boolean} variants (see
* {@link #setAdditionalPropertiesBoolean(Boolean)}).
*
* @deprecated since 1.1, use @link {@link #setAdditionalPropertiesSchema(Schema)} instead
* @param additionalProperties a Schema which defines additional properties
*/
@Deprecated
default void setAdditionalProperties(Schema additionalProperties) {
setAdditionalPropertiesSchema(additionalProperties);
}
/**
* Sets the Schema which defines additional properties not defined by "properties" or "patternProperties".
* See the javadoc for {@link Schema#getAdditionalPropertiesSchema()} for more details on this setting. Note
* that this version of the setter is mutually exclusive with the {@link Boolean} variants (see
* {@link #setAdditionalPropertiesBoolean(Boolean)}).
*
* @param additionalProperties a Schema which defines additional properties
*/
void setAdditionalPropertiesSchema(Schema additionalProperties);
/**
* Sets the value of "additionalProperties" to either True or False. See the javadoc for
* {@link Schema#getAdditionalPropertiesBoolean()} for more details on this setting. Note that
* this version of the setter is mutually exclusive with the {@link Schema} variants (see
* {@link #setAdditionalPropertiesSchema(Schema)}).
*
* @deprecated since 1.1, use @link {@link #setAdditionalPropertiesBoolean(Boolean)} instead
* @param additionalProperties a Schema which defines additional properties
*/
@Deprecated
default void setAdditionalProperties(Boolean additionalProperties) {
setAdditionalPropertiesBoolean(additionalProperties);
}
/**
* Sets the value of "additionalProperties" to either True or False. See the javadoc for
* {@link Schema#getAdditionalPropertiesBoolean()} for more details on this setting. Note that
* this version of the setter is mutually exclusive with the {@link Schema} variants (see
* {@link #setAdditionalPropertiesSchema(Schema)}).
*
* @param additionalProperties a Schema which defines additional properties
*/
void setAdditionalPropertiesBoolean(Boolean additionalProperties);
/**
* Sets the Schema which defines additional properties not defined by "properties" or "patternProperties".
* See the javadoc for {@link Schema#getAdditionalPropertiesSchema()} for more details on this setting. Note
* that this version of the setter is mutually exclusive with the {@link Boolean} variants (see
* {@link #additionalPropertiesBoolean(Boolean)}).
*
* @deprecated since 1.1, use @link {@link #additionalPropertiesSchema(Schema)} instead
* @param additionalProperties a Schema which defines additional properties
* @return the current Schema instance
*/
@Deprecated
default Schema additionalProperties(Schema additionalProperties) {
return additionalPropertiesSchema(additionalProperties);
}
/**
* Sets the Schema which defines additional properties not defined by "properties" or "patternProperties".
* See the javadoc for {@link Schema#getAdditionalPropertiesSchema()} for more details on this setting. Note
* that this version of the setter is mutually exclusive with the {@link Boolean} variants (see
* {@link #additionalPropertiesBoolean(Boolean)}).
*
* @param additionalProperties a Schema which defines additional properties
* @return the current Schema instance
*/
default Schema additionalPropertiesSchema(Schema additionalProperties) {
setAdditionalPropertiesSchema(additionalProperties);
return this;
}
/**
* Sets the value of "additionalProperties" to either True or False. See the javadoc for
* {@link Schema#getAdditionalPropertiesBoolean()} for more details on this setting. Note that
* this version of the setter is mutually exclusive with the {@link Schema} variants (see
* {@link #additionalPropertiesSchema(Schema)}).
*
* @deprecated since 1.1, use @link {@link #additionalPropertiesBoolean(Boolean)} instead
* @param additionalProperties a Schema which defines additional properties
* @return the current Schema instance
*/
@Deprecated
default Schema additionalProperties(Boolean additionalProperties) {
return additionalPropertiesBoolean(additionalProperties);
}
/**
* Sets the value of "additionalProperties" to either True or False. See the javadoc for
* {@link Schema#getAdditionalPropertiesBoolean()} for more details on this setting. Note that
* this version of the setter is mutually exclusive with the {@link Schema} variants (see
* {@link #additionalPropertiesSchema(Schema)}).
*
* @param additionalProperties a Schema which defines additional properties
* @return the current Schema instance
*/
default Schema additionalPropertiesBoolean(Boolean additionalProperties) {
setAdditionalPropertiesBoolean(additionalProperties);
return this;
}
/**
* Returns a description of the purpose of this Schema.
*
* @return a string containing a description
**/
String getDescription();
/**
* Sets the description property of this Schema to the given string.
*
* @param description a string containing a description of the purpose of this Schema
*/
void setDescription(String description);
/**
* Sets the description property of this Schema to the given string.
*
* @param description a string containing a description of the purpose of this Schema
* @return the current Schema instance
*/
default Schema description(String description) {
setDescription(description);
return this;
}
/**
* Returns the format property from this Schema instance. This property clarifies the data type specified in the type property.
*
* @return a string describing the format of the data in this Schema
**/
String getFormat();
/**
* Sets the format property of this Schema instance to the given string. The value may be one of the formats described in the OAS or a user
* defined format.
*
* @param format the string specifying the data format
*/
void setFormat(String format);
/**
* Sets the format property of this Schema instance to the given string. The value may be one of the formats described in the OAS or a user
* defined format.
*
* @param format the string specifying the data format
* @return the current Schema instance
*/
default Schema format(String format) {
setFormat(format);
return this;
}
/**
* Returns the nullable property from this Schema instance which indicates whether null is a valid value.
*
* @return the nullable property
**/
Boolean getNullable();
/**
* Sets the nullable property of this Schema instance. Specify true if this Schema will allow null values.
*
* @param nullable a boolean value indicating this Schema allows a null value.
*/
void setNullable(Boolean nullable);
/**
* Sets the nullable property of this Schema instance. Specify true if this Schema will allow null values.
*
* @param nullable a boolean value indicating this Schema allows a null value.
* @return the current Schema instance
*/
default Schema nullable(Boolean nullable) {
setNullable(nullable);
return this;
}
/**
* Returns the readOnly property from this Schema instance.
*
* @return indication that the Schema is only valid in a response message
**/
Boolean getReadOnly();
/**
* Sets the readOnly property of this Schema. Only valid when the Schema is the property in an object.
*
* @param readOnly true indicates the Schema should not be sent as part of a request message
*/
void setReadOnly(Boolean readOnly);
/**
* Sets the readOnly property of this Schema. Only valid when the Schema is the property in an object.
*
* @param readOnly true indicates the Schema should not be sent as part of a request message
* @return the current Schema instance
*/
default Schema readOnly(Boolean readOnly) {
setReadOnly(readOnly);
return this;
}
/**
* Returns the writeOnly property from this Schema instance.
*
* @return indication that the Schema is only valid in a request message
**/
Boolean getWriteOnly();
/**
* Sets the writeOnly property of this Schema. Only valid when the Schema is the property in an object.
*
* @param writeOnly true indicates the Schema should not be sent as part of a response message
*/
void setWriteOnly(Boolean writeOnly);
/**
* Sets the writeOnly property of this Schema. Only valid when the Schema is the property in an object.
*
* @param writeOnly true indicates the Schema should not be sent as part of a response message
* @return the current Schema instance
*/
default Schema writeOnly(Boolean writeOnly) {
setWriteOnly(writeOnly);
return this;
}
/**
* Returns the example property from this Schema instance.
*
* @return an object which is an example of an instance of this Schema
**/
Object getExample();
/**
* Sets the example property of this Schema instance. To represent examples that cannot be naturally represented in JSON or YAML, a string value
* can be used to contain the example with escaping where necessary.
*
* @param example an object which is an instance of this Schema
*/
void setExample(Object example);
/**
* Sets the example property of this Schema instance. To represent examples that cannot be naturally represented in JSON or YAML, a string value
* can be used to contain the example with escaping where necessary.
*
* @param example an object which is an instance of this Schema
* @return the current Schema instance
*/
default Schema example(Object example) {
setExample(example);
return this;
}
/**
* Returns the externalDocs property from this Schema instance.
*
* @return additional external documentation for this Schema
**/
ExternalDocumentation getExternalDocs();
/**
* Sets the externalDocs property of this Schema to the indicated value.
*
* @param externalDocs an additional external documentation object
*/
void setExternalDocs(ExternalDocumentation externalDocs);
/**
* Sets the externalDocs property of this Schema to the indicated value.
*
* @param externalDocs an additional external documentation object
* @return the current Schema instance
*/
default Schema externalDocs(ExternalDocumentation externalDocs) {
setExternalDocs(externalDocs);
return this;
}
/**
* Returns the deprecated property from this Schema instance.
*
* @return indication that the Schema is deprecated and should be transitioned out of usage
**/
Boolean getDeprecated();
/**
* Sets the deprecated property of this Schema. This specifies that the Schema is deprecated and should be transitioned out of usage
*
* @param deprecated true to indicate this Schema is deprecated
*/
void setDeprecated(Boolean deprecated);