001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.dto.swagger; 014 015import static org.apache.juneau.internal.BeanPropertyUtils.*; 016import java.util.*; 017 018import org.apache.juneau.annotation.*; 019import org.apache.juneau.internal.*; 020import org.apache.juneau.utils.*; 021 022/** 023 * The Schema Object allows the definition of input and output data types. 024 * 025 * <p> 026 * These types can be objects, but also primitives and arrays. 027 * This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it. 028 * On top of this subset, there are extensions provided by this specification to allow for more complete documentation. 029 * 030 * <p> 031 * Further information about the properties can be found in JSON Schema Core and JSON Schema Validation. 032 * Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here. 033 * 034 * <h5 class='section'>Example:</h5> 035 * <p class='bcode w800'> 036 * <jc>// Construct using SwaggerBuilder.</jc> 037 * SchemaInfo x = <jsm>schemaInfo</jsm>() 038 * .type("string") 039 * .title("foo") 040 * 041 * <jc>// Serialize using JsonSerializer.</jc> 042 * String json = JsonSerializer.<jsf>DEFAULT</jsf>.toString(x); 043 * 044 * <jc>// Or just use toString() which does the same as above.</jc> 045 * String json = x.toString(); 046 * </p> 047 * <p class='bcode w800'> 048 * <jc>// Output</jc> 049 * { 050 * <js>"type"</js>: <js>"string"</js>, 051 * <js>"title"</js>: <js>"foo"</js> 052 * } 053 * </p> 054 * 055 * <h5 class='section'>See Also:</h5> 056 * <ul class='doctree'> 057 * <li class='link'>{@doc juneau-dto.Swagger} 058 * </ul> 059 */ 060@Bean(properties="format,title,description,default,multipleOf,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,maxProperties,minProperties,required,enum,type,items,allOf,properties,additionalProperties,discriminator,readOnly,xml,externalDocs,example,$ref,*") 061public class SchemaInfo extends SwaggerElement { 062 063 private String 064 format, 065 title, 066 description, 067 pattern, 068 type, 069 discriminator, 070 ref; 071 private Number 072 multipleOf, 073 maximum, 074 minimum; 075 private Integer 076 maxLength, 077 minLength, 078 maxItems, 079 minItems, 080 maxProperties, 081 minProperties; 082 private Boolean 083 exclusiveMaximum, 084 exclusiveMinimum, 085 uniqueItems, 086 readOnly; 087 private Object 088 _default, 089 example; 090 private Items items; 091 private Xml xml; 092 private ExternalDocumentation externalDocs; 093 private List<Object> 094 _enum, 095 allOf; 096 private List<String> 097 required; 098 private Map<String,SchemaInfo> properties; 099 private SchemaInfo additionalProperties; 100 101 /** 102 * Default constructor. 103 */ 104 public SchemaInfo() {} 105 106 /** 107 * Copy constructor. 108 * 109 * @param copyFrom The object to copy. 110 */ 111 public SchemaInfo(SchemaInfo copyFrom) { 112 super(copyFrom); 113 114 this.format = copyFrom.format; 115 this.title = copyFrom.title; 116 this.description = copyFrom.description; 117 this.pattern = copyFrom.pattern; 118 this.type = copyFrom.type; 119 this.discriminator = copyFrom.discriminator; 120 this.ref = copyFrom.ref; 121 this.multipleOf = copyFrom.multipleOf; 122 this.maximum = copyFrom.maximum; 123 this.minimum = copyFrom.minimum; 124 this.maxLength = copyFrom.maxLength; 125 this.minLength = copyFrom.minLength; 126 this.maxItems = copyFrom.maxItems; 127 this.minItems = copyFrom.minItems; 128 this.maxProperties = copyFrom.maxProperties; 129 this.minProperties = copyFrom.minProperties; 130 this.exclusiveMaximum = copyFrom.exclusiveMaximum; 131 this.exclusiveMinimum = copyFrom.exclusiveMinimum; 132 this.uniqueItems = copyFrom.uniqueItems; 133 this.readOnly = copyFrom.readOnly; 134 this._default = copyFrom._default; 135 this.example = copyFrom.example; 136 this.items = copyFrom.items == null ? null : copyFrom.items.copy(); 137 this.xml = copyFrom.xml == null ? null : copyFrom.xml.copy(); 138 this.externalDocs = copyFrom.externalDocs == null ? null : copyFrom.externalDocs.copy(); 139 this._enum = newList(copyFrom._enum); 140 this.allOf = newList(copyFrom.allOf); 141 this.required = newList(copyFrom.required); 142 143 if (copyFrom.properties == null) { 144 this.properties = null; 145 } else { 146 this.properties = new LinkedHashMap<>(); 147 for (Map.Entry<String,SchemaInfo> e : copyFrom.properties.entrySet()) 148 this.properties.put(e.getKey(), e.getValue().copy()); 149 } 150 151 this.additionalProperties = copyFrom.additionalProperties == null ? null : copyFrom.additionalProperties.copy(); 152 } 153 154 /** 155 * Make a deep copy of this object. 156 * 157 * @return A deep copy of this object. 158 */ 159 public SchemaInfo copy() { 160 return new SchemaInfo(this); 161 } 162 163 /** 164 * Bean property getter: <property>format</property>. 165 * 166 * <h5 class='section'>See Also:</h5> 167 * <ul> 168 * <li class='extlink'>{@doc SwaggerDataTypeFormats} 169 * </ul> 170 * 171 * @return The property value, or <jk>null</jk> if it is not set. 172 */ 173 public String getFormat() { 174 return format; 175 } 176 177 /** 178 * Bean property setter: <property>format</property>. 179 * 180 * <h5 class='section'>See Also:</h5> 181 * <ul class='doctree'> 182 * <li class='extlink'>{@doc SwaggerDataTypes} 183 * </ul> 184 * 185 * @param value 186 * The new value for this property. 187 * <br>Can be <jk>null</jk> to unset the property. 188 * <br>Formats defined by the OAS include: 189 * <ul> 190 * <li><js>"int32"</js> 191 * <li><js>"int64"</js> 192 * <li><js>"float"</js> 193 * <li><js>"double"</js> 194 * <li><js>"byte"</js> 195 * <li><js>"binary"</js> 196 * <li><js>"date"</js> 197 * <li><js>"date-time"</js> 198 * <li><js>"password"</js> 199 * </ul> 200 * @return This object (for method chaining). 201 */ 202 public SchemaInfo setFormat(String value) { 203 format = value; 204 return this; 205 } 206 207 /** 208 * Same as {@link #setFormat(String)}. 209 * 210 * @param value 211 * The new value for this property. 212 * <br>Non-String values will be converted to String using <code>toString()</code>. 213 * <br>Can be <jk>null</jk> to unset the property. 214 * @return This object (for method chaining). 215 */ 216 public SchemaInfo format(Object value) { 217 return setFormat(toStringVal(value)); 218 } 219 220 /** 221 * Bean property getter: <property>title</property>. 222 * 223 * @return The property value, or <jk>null</jk> if it is not set. 224 */ 225 public String getTitle() { 226 return title; 227 } 228 229 /** 230 * Bean property setter: <property>title</property>. 231 * 232 * @param value 233 * The new value for this property. 234 * <br>Can be <jk>null</jk> to unset the property. 235 * @return This object (for method chaining). 236 */ 237 public SchemaInfo setTitle(String value) { 238 title = value; 239 return this; 240 } 241 242 /** 243 * Same as {@link #setTitle(String)}. 244 * 245 * @param value 246 * The new value for this property. 247 * <br>Non-String values will be converted to String using <code>toString()</code>. 248 * <br>Can be <jk>null</jk> to unset the property. 249 * @return This object (for method chaining). 250 */ 251 public SchemaInfo title(Object value) { 252 return setTitle(toStringVal(value)); 253 } 254 255 /** 256 * Bean property getter: <property>description</property>. 257 * 258 * @return The property value, or <jk>null</jk> if it is not set. 259 */ 260 public String getDescription() { 261 return description; 262 } 263 264 /** 265 * Bean property setter: <property>description</property>. 266 * 267 * @param value 268 * The new value for this property. 269 * <br>{@doc GFM} can be used for rich text representation. 270 * <br>Can be <jk>null</jk> to unset the property. 271 * @return This object (for method chaining). 272 */ 273 public SchemaInfo setDescription(String value) { 274 description = value; 275 return this; 276 } 277 278 /** 279 * Same as {@link #setDescription(String)}. 280 * 281 * @param value 282 * The new value for this property. 283 * <br>Non-String values will be converted to String using <code>toString()</code>. 284 * <br>Can be <jk>null</jk> to unset the property. 285 * @return This object (for method chaining). 286 */ 287 public SchemaInfo description(Object value) { 288 return setDescription(toStringVal(value)); 289 } 290 291 /** 292 * Bean property getter: <property>default</property>. 293 * 294 * <p> 295 * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object. 296 * 297 * @return The property value, or <jk>null</jk> if it is not set. 298 */ 299 public Object getDefault() { 300 return _default; 301 } 302 303 /** 304 * Bean property setter: <property>default</property>. 305 * 306 * <p> 307 * Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object. 308 * 309 * @param value 310 * The new value for this property. 311 * <br>Can be <jk>null</jk> to unset the property. 312 * @return This object (for method chaining). 313 */ 314 public SchemaInfo setDefault(Object value) { 315 _default = value; 316 return this; 317 } 318 319 /** 320 * Same as {@link #setDefault(Object)}. 321 * 322 * @param value The new value for this property. 323 * @return This object (for method chaining). 324 */ 325 public SchemaInfo _default(Object value) { 326 return setDefault(value); 327 } 328 329 /** 330 * Bean property getter: <property>multipleOf</property>. 331 * 332 * @return The property value, or <jk>null</jk> if it is not set. 333 */ 334 public Number getMultipleOf() { 335 return multipleOf; 336 } 337 338 /** 339 * Bean property setter: <property>multipleOf</property>. 340 * 341 * @param value 342 * The new value for this property. 343 * <br>Can be <jk>null</jk> to unset the property. 344 * @return This object (for method chaining). 345 */ 346 public SchemaInfo setMultipleOf(Number value) { 347 multipleOf = value; 348 return this; 349 } 350 351 /** 352 * Same as {@link #setMultipleOf(Number)}. 353 * 354 * @param value 355 * The new value for this property. 356 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 357 * <br>Can be <jk>null</jk> to unset the property. 358 * @return This object (for method chaining). 359 */ 360 public SchemaInfo multipleOf(Object value) { 361 return setMultipleOf(toNumber(value)); 362 } 363 364 /** 365 * Bean property getter: <property>maximum</property>. 366 * 367 * @return The property value, or <jk>null</jk> if it is not set. 368 */ 369 public Number getMaximum() { 370 return maximum; 371 } 372 373 /** 374 * Bean property setter: <property>maximum</property>. 375 * 376 * @param value 377 * The new value for this property. 378 * <br>Can be <jk>null</jk> to unset the property. 379 * @return This object (for method chaining). 380 */ 381 public SchemaInfo setMaximum(Number value) { 382 maximum = value; 383 return this; 384 } 385 386 /** 387 * Same as {@link #setMaximum(Number)}. 388 * 389 * @param value 390 * The new value for this property. 391 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 392 * <br>Can be <jk>null</jk> to unset the property. 393 * @return This object (for method chaining). 394 */ 395 public SchemaInfo maximum(Object value) { 396 return setMaximum(toNumber(value)); 397 } 398 399 /** 400 * Bean property getter: <property>exclusiveMaximum</property>. 401 * 402 * @return The property value, or <jk>null</jk> if it is not set. 403 */ 404 public Boolean getExclusiveMaximum() { 405 return exclusiveMaximum; 406 } 407 408 /** 409 * Bean property setter: <property>exclusiveMaximum</property>. 410 * 411 * @param value 412 * The new value for this property. 413 * <br>Can be <jk>null</jk> to unset the property. 414 * @return This object (for method chaining). 415 */ 416 public SchemaInfo setExclusiveMaximum(Boolean value) { 417 exclusiveMaximum = value; 418 return this; 419 } 420 421 /** 422 * Same as {@link #setExclusiveMaximum(Boolean)}. 423 * 424 * @param value 425 * The new value for this property. 426 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 427 * <br>Can be <jk>null</jk> to unset the property. 428 * @return This object (for method chaining). 429 */ 430 public SchemaInfo exclusiveMaximum(Object value) { 431 return setExclusiveMaximum(toBoolean(value)); 432 } 433 434 /** 435 * Bean property getter: <property>minimum</property>. 436 * 437 * @return The property value, or <jk>null</jk> if it is not set. 438 */ 439 public Number getMinimum() { 440 return minimum; 441 } 442 443 /** 444 * Bean property setter: <property>minimum</property>. 445 * 446 * @param value 447 * The new value for this property. 448 * <br>Can be <jk>null</jk> to unset the property. 449 * @return This object (for method chaining). 450 */ 451 public SchemaInfo setMinimum(Number value) { 452 minimum = value; 453 return this; 454 } 455 456 /** 457 * Same as {@link #setMinimum(Number)}. 458 * 459 * @param value 460 * The new value for this property. 461 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 462 * <br>Can be <jk>null</jk> to unset the property. 463 * @return This object (for method chaining). 464 */ 465 public SchemaInfo minimum(Object value) { 466 return setMinimum(toNumber(value)); 467 } 468 469 /** 470 * Bean property getter: <property>exclusiveMinimum</property>. 471 * 472 * @return The property value, or <jk>null</jk> if it is not set. 473 */ 474 public Boolean getExclusiveMinimum() { 475 return exclusiveMinimum; 476 } 477 478 /** 479 * Bean property setter: <property>exclusiveMinimum</property>. 480 * 481 * @param value 482 * The new value for this property. 483 * <br>Can be <jk>null</jk> to unset the property. 484 * @return This object (for method chaining). 485 */ 486 public SchemaInfo setExclusiveMinimum(Boolean value) { 487 exclusiveMinimum = value; 488 return this; 489 } 490 491 /** 492 * Same as {@link #setExclusiveMinimum(Boolean)}. 493 * 494 * @param value 495 * The new value for this property. 496 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 497 * <br>Can be <jk>null</jk> to unset the property. 498 * @return This object (for method chaining). 499 */ 500 public SchemaInfo exclusiveMinimum(Object value) { 501 return setExclusiveMinimum(toBoolean(value)); 502 } 503 504 /** 505 * Bean property getter: <property>maxLength</property>. 506 * 507 * @return The property value, or <jk>null</jk> if it is not set. 508 */ 509 public Integer getMaxLength() { 510 return maxLength; 511 } 512 513 /** 514 * Bean property setter: <property>maxLength</property>. 515 * 516 * @param value 517 * The new value for this property. 518 * <br>Can be <jk>null</jk> to unset the property. 519 * @return This object (for method chaining). 520 */ 521 public SchemaInfo setMaxLength(Integer value) { 522 maxLength = value; 523 return this; 524 } 525 526 /** 527 * Same as {@link #setMaxLength(Integer)}. 528 * 529 * @param value 530 * The new value for this property. 531 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 532 * <br>Can be <jk>null</jk> to unset the property. 533 * @return This object (for method chaining). 534 */ 535 public SchemaInfo maxLength(Object value) { 536 return setMaxLength(toInteger(value)); 537 } 538 539 /** 540 * Bean property getter: <property>minLength</property>. 541 * 542 * @return The property value, or <jk>null</jk> if it is not set. 543 */ 544 public Integer getMinLength() { 545 return minLength; 546 } 547 548 /** 549 * Bean property setter: <property>minLength</property>. 550 * 551 * @param value 552 * The new value for this property. 553 * <br>Can be <jk>null</jk> to unset the property. 554 * @return This object (for method chaining). 555 */ 556 public SchemaInfo setMinLength(Integer value) { 557 minLength = value; 558 return this; 559 } 560 561 /** 562 * Same as {@link #setMinLength(Integer)}. 563 * 564 * @param value 565 * The new value for this property. 566 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 567 * <br>Can be <jk>null</jk> to unset the property. 568 * @return This object (for method chaining). 569 */ 570 public SchemaInfo minLength(Object value) { 571 return setMinLength(toInteger(value)); 572 } 573 574 /** 575 * Bean property getter: <property>pattern</property>. 576 * 577 * @return The property value, or <jk>null</jk> if it is not set. 578 */ 579 public String getPattern() { 580 return pattern; 581 } 582 583 /** 584 * Bean property setter: <property>pattern</property>. 585 * 586 * <p> 587 * This string SHOULD be a valid regular expression. 588 * 589 * @param value 590 * The new value for this property. 591 * <br>Can be <jk>null</jk> to unset the property. 592 * @return This object (for method chaining). 593 */ 594 public SchemaInfo setPattern(String value) { 595 pattern = value; 596 return this; 597 } 598 599 /** 600 * Same as {@link #setPattern(String)}. 601 * 602 * @param value 603 * The new value for this property. 604 * <br>Non-String values will be converted to String using <code>toString()</code>. 605 * <br>Can be <jk>null</jk> to unset the property. 606 * @return This object (for method chaining). 607 */ 608 public SchemaInfo pattern(Object value) { 609 return setPattern(toStringVal(value)); 610 } 611 612 /** 613 * Bean property getter: <property>maxItems</property>. 614 * 615 * @return The property value, or <jk>null</jk> if it is not set. 616 */ 617 public Integer getMaxItems() { 618 return maxItems; 619 } 620 621 /** 622 * Bean property setter: <property>maxItems</property>. 623 * 624 * @param value 625 * The new value for this property. 626 * <br>Can be <jk>null</jk> to unset the property. 627 * @return This object (for method chaining). 628 */ 629 public SchemaInfo setMaxItems(Integer value) { 630 maxItems = value; 631 return this; 632 } 633 634 /** 635 * Same as {@link #setMaxItems(Integer)}. 636 * 637 * @param value 638 * The new value for this property. 639 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 640 * <br>Can be <jk>null</jk> to unset the property. 641 * @return This object (for method chaining). 642 */ 643 public SchemaInfo maxItems(Object value) { 644 return setMaxItems(toInteger(value)); 645 } 646 647 /** 648 * Bean property getter: <property>minItems</property>. 649 * 650 * @return The property value, or <jk>null</jk> if it is not set. 651 */ 652 public Integer getMinItems() { 653 return minItems; 654 } 655 656 /** 657 * Bean property setter: <property>minItems</property>. 658 * 659 * @param value 660 * The new value for this property. 661 * <br>Can be <jk>null</jk> to unset the property. 662 * @return This object (for method chaining). 663 */ 664 public SchemaInfo setMinItems(Integer value) { 665 minItems = value; 666 return this; 667 } 668 669 /** 670 * Same as {@link #setMinItems(Integer)}. 671 * 672 * @param value 673 * The new value for this property. 674 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 675 * <br>Can be <jk>null</jk> to unset the property. 676 * @return This object (for method chaining). 677 */ 678 public SchemaInfo minItems(Object value) { 679 return setMinItems(toInteger(value)); 680 } 681 682 /** 683 * Bean property getter: <property>uniqueItems</property>. 684 * 685 * @return The property value, or <jk>null</jk> if it is not set. 686 */ 687 public Boolean getUniqueItems() { 688 return uniqueItems; 689 } 690 /** 691 * Bean property setter: <property>uniqueItems</property>. 692 * 693 * @param value 694 * The new value for this property. 695 * <br>Can be <jk>null</jk> to unset the property. 696 * @return This object (for method chaining). 697 */ 698 public SchemaInfo setUniqueItems(Boolean value) { 699 uniqueItems = value; 700 return this; 701 } 702 703 /** 704 * Same as {@link #setUniqueItems(Boolean)}. 705 * 706 * @param value 707 * The new value for this property. 708 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 709 * <br>Can be <jk>null</jk> to unset the property. 710 * @return This object (for method chaining). 711 */ 712 public SchemaInfo uniqueItems(Object value) { 713 return setUniqueItems(toBoolean(value)); 714 } 715 716 /** 717 * Bean property getter: <property>maxProperties</property>. 718 * 719 * @return The property value, or <jk>null</jk> if it is not set. 720 */ 721 public Integer getMaxProperties() { 722 return maxProperties; 723 } 724 725 /** 726 * Bean property setter: <property>maxProperties</property>. 727 * 728 * @param value 729 * The new value for this property. 730 * <br>Can be <jk>null</jk> to unset the property. 731 * @return This object (for method chaining). 732 */ 733 public SchemaInfo setMaxProperties(Integer value) { 734 maxProperties = value; 735 return this; 736 } 737 738 /** 739 * Same as {@link #setMaxProperties(Integer)}. 740 * 741 * @param value 742 * The new value for this property. 743 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 744 * <br>Can be <jk>null</jk> to unset the property. 745 * @return This object (for method chaining). 746 */ 747 public SchemaInfo maxProperties(Object value) { 748 return setMaxProperties(toInteger(value)); 749 } 750 751 /** 752 * Bean property getter: <property>minProperties</property>. 753 * 754 * @return The property value, or <jk>null</jk> if it is not set. 755 */ 756 public Integer getMinProperties() { 757 return minProperties; 758 } 759 760 /** 761 * Bean property setter: <property>minProperties</property>. 762 * 763 * @param value 764 * The new value for this property. 765 * <br>Can be <jk>null</jk> to unset the property. 766 * @return This object (for method chaining). 767 */ 768 public SchemaInfo setMinProperties(Integer value) { 769 minProperties = value; 770 return this; 771 } 772 773 /** 774 * Same as {@link #setMinProperties(Integer)}. 775 * 776 * @param value 777 * The new value for this property. 778 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 779 * <br>Can be <jk>null</jk> to unset the property. 780 * @return This object (for method chaining). 781 */ 782 public SchemaInfo minProperties(Object value) { 783 return setMinProperties(toInteger(value)); 784 } 785 786 /** 787 * Bean property getter: <property>required</property>. 788 * 789 * <p> 790 * The list of required properties. 791 * 792 * @return The property value, or <jk>null</jk> if it is not set. 793 */ 794 public List<String> getRequired() { 795 return required; 796 } 797 798 /** 799 * Bean property setter: <property>required</property>. 800 * 801 * <p> 802 * The list of required properties. 803 * 804 * @param value 805 * The new value for this property. 806 * <br>Valid values: 807 * <ul> 808 * <li><js>"http"</js> 809 * <li><js>"https"</js> 810 * <li><js>"ws"</js> 811 * <li><js>"wss"</js> 812 * </ul> 813 * <br>Can be <jk>null</jk> to unset the property. 814 * @return This object (for method chaining). 815 */ 816 public SchemaInfo setRequired(Collection<String> value) { 817 required = newList(value); 818 return this; 819 } 820 821 /** 822 * Adds one or more values to the <property>required</property> property. 823 * 824 * <p> 825 * The list of required properties. 826 * 827 * @param value 828 * The values to add to this property. 829 * <br>Ignored if <jk>null</jk>. 830 * @return This object (for method chaining). 831 */ 832 public SchemaInfo addRequired(Collection<String> value) { 833 required = addToList(required, value); 834 return this; 835 } 836 837 /** 838 * Same as {@link #addRequired(Collection)}. 839 * 840 * @param values 841 * The new value for this property. 842 * <br>Valid types: 843 * <ul> 844 * <li><code>Collection<String></code> 845 * <li><code>String</code> - JSON array representation of <code>Collection<String></code> 846 * <h5 class='figure'>Example:</h5> 847 * <p class='bcode w800'> 848 * schemes(<js>"['scheme1','scheme2']"</js>); 849 * </p> 850 * <li><code>String</code> - Individual values 851 * <h5 class='figure'>Example:</h5> 852 * <p class='bcode w800'> 853 * schemes(<js>"scheme1</js>, <js>"scheme2"</js>); 854 * </p> 855 * </ul> 856 * @return This object (for method chaining). 857 */ 858 public SchemaInfo required(Object...values) { 859 required = addToList(required, values, String.class); 860 return this; 861 } 862 863 /** 864 * Bean property getter: <property>enum</property>. 865 * 866 * @return The property value, or <jk>null</jk> if it is not set. 867 */ 868 public List<Object> getEnum() { 869 return _enum; 870 } 871 872 /** 873 * Bean property setter: <property>enum</property>. 874 * 875 * <h5 class='section'>See Also:</h5> 876 * <ul> 877 * <li class='extlink'>{@doc JsonSchemaValidation} 878 * </ul> 879 * 880 * @param value 881 * The new value for this property. 882 * <br>Can be <jk>null</jk> to unset the property. 883 * @return This object (for method chaining). 884 */ 885 public SchemaInfo setEnum(Collection<Object> value) { 886 _enum = newList(value); 887 return this; 888 } 889 890 /** 891 * Adds one or more values to the <property>enum</property> property. 892 * 893 * @param value 894 * The values to add to this property. 895 * <br>Ignored if <jk>null</jk>. 896 * @return This object (for method chaining). 897 */ 898 public SchemaInfo addEnum(Collection<Object> value) { 899 _enum = addToList(_enum, value); 900 return this; 901 } 902 903 /** 904 * Adds one or more values to the <property>enum</property> property. 905 * 906 * @param values 907 * The values to add to this property. 908 * <br>Valid types: 909 * <ul> 910 * <li><code>Object</code> 911 * <li><code>Collection<Object></code> 912 * <li><code>String</code> - JSON array representation of <code>Collection<Object></code> 913 * <h5 class='figure'>Example:</h5> 914 * <p class='bcode w800'> 915 * _enum(<js>"['foo','bar']"</js>); 916 * </p> 917 * <li><code>String</code> - Individual values 918 * <h5 class='figure'>Example:</h5> 919 * <p class='bcode w800'> 920 * _enum(<js>"foo"</js>, <js>"bar"</js>); 921 * </p> 922 * </ul> 923 * <br>Ignored if <jk>null</jk>. 924 * @return This object (for method chaining). 925 */ 926 public SchemaInfo _enum(Object...values) { 927 _enum = addToList(_enum, values, Object.class); 928 return this; 929 } 930 931 /** 932 * Bean property getter: <property>type</property>. 933 * 934 * @return The property value, or <jk>null</jk> if it is not set. 935 */ 936 public String getType() { 937 return type; 938 } 939 940 /** 941 * Bean property setter: <property>type</property>. 942 * 943 * <h5 class='section'>See Also:</h5> 944 * <ul class='doctree'> 945 * <li class='extlink'>{@doc SwaggerDataTypes} 946 * </ul> 947 * 948 * @param value 949 * The new value for this property. 950 * <br>Can be <jk>null</jk> to unset the property. 951 * <br>Possible values include: 952 * <ul> 953 * <li><js>"object"</js> 954 * <li><js>"string"</js> 955 * <li><js>"number"</js> 956 * <li><js>"integer"</js> 957 * <li><js>"boolean"</js> 958 * <li><js>"array"</js> 959 * <li><js>"file"</js> 960 * </ul> 961 * @return This object (for method chaining). 962 */ 963 public SchemaInfo setType(String value) { 964 type = value; 965 return this; 966 } 967 968 /** 969 * Same as {@link #setType(String)}. 970 * 971 * @param value 972 * The new value for this property. 973 * <br>Non-String values will be converted to String using <code>toString()</code>. 974 * <br>Can be <jk>null</jk> to unset the property. 975 * @return This object (for method chaining). 976 */ 977 public SchemaInfo type(Object value) { 978 return setType(toStringVal(value)); 979 } 980 981 /** 982 * Bean property getter: <property>items</property>. 983 * 984 * @return The property value, or <jk>null</jk> if it is not set. 985 */ 986 public Items getItems() { 987 return items; 988 } 989 990 /** 991 * Bean property setter: <property>items</property>. 992 * 993 * @param value 994 * The new value for this property. 995 * <br>Can be <jk>null</jk> to unset the property. 996 * @return This object (for method chaining). 997 */ 998 public SchemaInfo setItems(Items value) { 999 items = value; 1000 return this; 1001 } 1002 1003 /** 1004 * Same as {@link #setItems(Items)}. 1005 * 1006 * @param value 1007 * The new value for this property. 1008 * <br>Valid types: 1009 * <ul> 1010 * <li>{@link Items} 1011 * <li><code>String</code> - JSON object representation of {@link Items} 1012 * <h5 class='figure'>Example:</h5> 1013 * <p class='bcode w800'> 1014 * items(<js>"{type:'type',format:'format',...}"</js>); 1015 * </p> 1016 * </ul> 1017 * <br>Can be <jk>null</jk> to unset the property. 1018 * @return This object (for method chaining). 1019 */ 1020 public SchemaInfo items(Object value) { 1021 return setItems(toType(value, Items.class)); 1022 } 1023 1024 /** 1025 * Bean property getter: <property>allOf</property>. 1026 * 1027 * @return The property value, or <jk>null</jk> if it is not set. 1028 */ 1029 public List<Object> getAllOf() { 1030 return allOf; 1031 } 1032 1033 /** 1034 * Bean property setter: <property>allOf</property>. 1035 * 1036 * @param value 1037 * The new value for this property. 1038 * <br>Can be <jk>null</jk> to unset the property. 1039 * @return This object (for method chaining). 1040 */ 1041 public SchemaInfo setAllOf(Collection<Object> value) { 1042 allOf = newList(value); 1043 return this; 1044 } 1045 1046 /** 1047 * Adds one or more values to the <property>allOf</property> property. 1048 * 1049 * @param values 1050 * The values to add to this property. 1051 * <br>Ignored if <jk>null</jk>. 1052 * @return This object (for method chaining). 1053 */ 1054 public SchemaInfo addAllOf(Collection<Object> values) { 1055 allOf = addToList(allOf, values); 1056 return this; 1057 } 1058 1059 /** 1060 * Adds one or more values to the <property>allOf</property> property. 1061 * 1062 * @param values 1063 * The values to add to this property. 1064 * <br>Valid types: 1065 * <ul> 1066 * <li><code>Object</code> 1067 * <li><code>Collection<Object></code> 1068 * <li><code>String</code> - JSON array representation of <code>Collection<Object></code> 1069 * <h5 class='figure'>Example:</h5> 1070 * <p class='bcode w800'> 1071 * allOf(<js>"['foo','bar']"</js>); 1072 * </p> 1073 * <li><code>String</code> - Individual values 1074 * <h5 class='figure'>Example:</h5> 1075 * <p class='bcode w800'> 1076 * allOf(<js>"foo"</js>, <js>"bar"</js>); 1077 * </p> 1078 * </ul> 1079 * <br>Ignored if <jk>null</jk>. 1080 * @return This object (for method chaining). 1081 */ 1082 public SchemaInfo allOf(Object...values) { 1083 allOf = addToList(allOf, values, Object.class); 1084 return this; 1085 } 1086 1087 /** 1088 * Bean property getter: <property>properties</property>. 1089 * 1090 * @return The property value, or <jk>null</jk> if it is not set. 1091 */ 1092 public Map<String,SchemaInfo> getProperties() { 1093 return properties; 1094 } 1095 1096 /** 1097 * Bean property setter: <property>properties</property>. 1098 * 1099 * @param value 1100 * The new value for this property. 1101 * <br>Can be <jk>null</jk> to unset the property. 1102 * @return This object (for method chaining). 1103 */ 1104 public SchemaInfo setProperties(Map<String,SchemaInfo> value) { 1105 properties = newMap(value); 1106 return this; 1107 } 1108 1109 /** 1110 * Adds one or more values to the <property>properties</property> property. 1111 * 1112 * @param values 1113 * The values to add to this property. 1114 * <br>Ignored if <jk>null</jk>. 1115 * @return This object (for method chaining). 1116 */ 1117 public SchemaInfo addProperties(Map<String,SchemaInfo> values) { 1118 properties = addToMap(properties, values); 1119 return this; 1120 } 1121 1122 /** 1123 * Adds one or more values to the <property>properties</property> property. 1124 * 1125 * @param values 1126 * The values to add to this property. 1127 * <br>Valid types: 1128 * <ul> 1129 * <li><code>Map<String,Map<String,Object>></code> 1130 * <li><code>String</code> - JSON object representation of <code>Map<String,Map<String,Object>></code> 1131 * <h5 class='figure'>Example:</h5> 1132 * <p class='bcode w800'> 1133 * properties(<js>"{name:{foo:'bar'}}"</js>); 1134 * </p> 1135 * </ul> 1136 * <br>Ignored if <jk>null</jk>. 1137 * @return This object (for method chaining). 1138 */ 1139 public SchemaInfo properties(Object...values) { 1140 properties = addToMap(properties, values, String.class, SchemaInfo.class); 1141 return this; 1142 } 1143 1144 /** 1145 * Bean property getter: <property>additionalProperties</property>. 1146 * 1147 * @return The property value, or <jk>null</jk> if it is not set. 1148 */ 1149 public SchemaInfo getAdditionalProperties() { 1150 return additionalProperties; 1151 } 1152 1153 /** 1154 * Bean property setter: <property>additionalProperties</property>. 1155 * 1156 * @param value 1157 * The new value for this property. 1158 * <br>Can be <jk>null</jk> to unset the property. 1159 * @return This object (for method chaining). 1160 */ 1161 public SchemaInfo setAdditionalProperties(SchemaInfo value) { 1162 additionalProperties = value; 1163 return this; 1164 } 1165 1166 /** 1167 * Bean property setter: <property>additionalProperties</property>. 1168 * 1169 * @param value 1170 * The new value for this property. 1171 * <br>Can be <jk>null</jk> to unset the property. 1172 * @return This object (for method chaining). 1173 */ 1174 public SchemaInfo additionalProperties(Object value) { 1175 additionalProperties = toType(value, SchemaInfo.class); 1176 return this; 1177 } 1178 1179 /** 1180 * Bean property getter: <property>discriminator</property>. 1181 * 1182 * @return The property value, or <jk>null</jk> if it is not set. 1183 */ 1184 public String getDiscriminator() { 1185 return discriminator; 1186 } 1187 1188 /** 1189 * Bean property setter: <property>discriminator</property>. 1190 * 1191 * @param value 1192 * The new value for this property. 1193 * <br>Can be <jk>null</jk> to unset the property. 1194 * @return This object (for method chaining). 1195 */ 1196 public SchemaInfo setDiscriminator(String value) { 1197 discriminator = value; 1198 return this; 1199 } 1200 1201 /** 1202 * Same as {@link #setDiscriminator(String)}. 1203 * 1204 * @param value 1205 * The new value for this property. 1206 * <br>Non-String values will be converted to String using <code>toString()</code>. 1207 * <br>Can be <jk>null</jk> to unset the property. 1208 * @return This object (for method chaining). 1209 */ 1210 public SchemaInfo discriminator(Object value) { 1211 return setDiscriminator(toStringVal(value)); 1212 } 1213 1214 /** 1215 * Bean property getter: <property>readOnly</property>. 1216 * 1217 * @return The property value, or <jk>null</jk> if it is not set. 1218 */ 1219 public Boolean getReadOnly() { 1220 return readOnly; 1221 } 1222 1223 /** 1224 * Bean property setter: <property>readOnly</property>. 1225 * 1226 * @param value 1227 * The new value for this property. 1228 * <br>Can be <jk>null</jk> to unset the property. 1229 * @return This object (for method chaining). 1230 */ 1231 public SchemaInfo setReadOnly(Boolean value) { 1232 readOnly = value; 1233 return this; 1234 } 1235 1236 /** 1237 * Same as {@link #setReadOnly(Boolean)}. 1238 * 1239 * @param value 1240 * The new value for this property. 1241 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 1242 * <br>Can be <jk>null</jk> to unset the property. 1243 * @return This object (for method chaining). 1244 */ 1245 public SchemaInfo readOnly(Object value) { 1246 return setReadOnly(toBoolean(value)); 1247 } 1248 1249 /** 1250 * Bean property getter: <property>xml</property>. 1251 * 1252 * @return The property value, or <jk>null</jk> if it is not set. 1253 */ 1254 public Xml getXml() { 1255 return xml; 1256 } 1257 1258 /** 1259 * Bean property setter: <property>xml</property>. 1260 * 1261 * @param value 1262 * The new value for this property. 1263 * <br>Can be <jk>null</jk> to unset the property. 1264 * @return This object (for method chaining). 1265 */ 1266 public SchemaInfo setXml(Xml value) { 1267 xml = value; 1268 return this; 1269 } 1270 1271 /** 1272 * Same as {@link #setXml(Xml)}. 1273 * 1274 * @param value 1275 * The new value for this property. 1276 * <br>Valid types: 1277 * <ul> 1278 * <li>{@link Xml} 1279 * <li><code>String</code> - JSON object representation of {@link Xml} 1280 * <h5 class='figure'>Example:</h5> 1281 * <p class='bcode w800'> 1282 * xml(<js>"{name:'name',namespace:'namespace',...}"</js>); 1283 * </p> 1284 * </ul> 1285 * <br>Can be <jk>null</jk> to unset the property. 1286 * @return This object (for method chaining). 1287 */ 1288 public SchemaInfo xml(Object value) { 1289 return setXml(toType(value, Xml.class)); 1290 } 1291 1292 /** 1293 * Bean property getter: <property>externalDocs</property>. 1294 * 1295 * @return The property value, or <jk>null</jk> if it is not set. 1296 */ 1297 public ExternalDocumentation getExternalDocs() { 1298 return externalDocs; 1299 } 1300 1301 /** 1302 * Bean property setter: <property>externalDocs</property>. 1303 * 1304 * @param value 1305 * The new value for this property. 1306 * <br>Can be <jk>null</jk> to unset the property. 1307 * @return This object (for method chaining). 1308 */ 1309 public SchemaInfo setExternalDocs(ExternalDocumentation value) { 1310 externalDocs = value; 1311 return this; 1312 } 1313 1314 /** 1315 * Same as {@link #setExternalDocs(ExternalDocumentation)}. 1316 * 1317 * @param value 1318 * The new value for this property. 1319 * <br>Valid types: 1320 * <ul> 1321 * <li>{@link ExternalDocumentation} 1322 * <li><code>String</code> - JSON object representation of {@link ExternalDocumentation} 1323 * <h5 class='figure'>Example:</h5> 1324 * <p class='bcode w800'> 1325 * externalDocs(<js>"{description:'description',url:'url'}"</js>); 1326 * </p> 1327 * </ul> 1328 * <br>Can be <jk>null</jk> to unset the property. 1329 * @return This object (for method chaining). 1330 */ 1331 public SchemaInfo externalDocs(Object value) { 1332 return setExternalDocs(toType(value, ExternalDocumentation.class)); 1333 } 1334 1335 /** 1336 * Bean property getter: <property>example</property>. 1337 * 1338 * @return The property value, or <jk>null</jk> if it is not set. 1339 */ 1340 public Object getExample() { 1341 return example; 1342 } 1343 1344 /** 1345 * Bean property setter: <property>example</property>. 1346 * 1347 * @param value 1348 * The new value for this property. 1349 * <br>Can be <jk>null</jk> to unset the property. 1350 * @return This object (for method chaining). 1351 */ 1352 public SchemaInfo setExample(Object value) { 1353 example = value; 1354 return this; 1355 } 1356 1357 /** 1358 * Same as {@link #setExample(Object)}. 1359 * 1360 * @param value 1361 * The new value for this property. 1362 * <br>Can be <jk>null</jk> to unset the property. 1363 * @return This object (for method chaining). 1364 */ 1365 public SchemaInfo example(Object value) { 1366 return setExample(value); 1367 } 1368 1369 /** 1370 * Bean property getter: <property>$ref</property>. 1371 * 1372 * @return The property value, or <jk>null</jk> if it is not set. 1373 */ 1374 @BeanProperty("$ref") 1375 public String getRef() { 1376 return ref; 1377 } 1378 1379 /** 1380 * Returns <jk>true</jk> if this object has a <js>"$ref"</js> attribute. 1381 * 1382 * @return <jk>true</jk> if this object has a <js>"$ref"</js> attribute. 1383 */ 1384 public boolean hasRef() { 1385 return ref != null; 1386 } 1387 1388 /** 1389 * Bean property setter: <property>$ref</property>. 1390 * 1391 * @param value 1392 * The new value for this property. 1393 * <br>Can be <jk>null</jk> to unset the property. 1394 * @return This object (for method chaining). 1395 */ 1396 @BeanProperty("$ref") 1397 public SchemaInfo setRef(Object value) { 1398 ref = StringUtils.asString(value); 1399 return this; 1400 } 1401 1402 /** 1403 * Same as {@link #setRef(Object)}. 1404 * 1405 * @param value 1406 * The new value for this property. 1407 * <br>Can be <jk>null</jk> to unset the property. 1408 * @return This object (for method chaining). 1409 */ 1410 public SchemaInfo ref(Object value) { 1411 return setRef(value); 1412 } 1413 1414 @Override /* SwaggerElement */ 1415 public <T> T get(String property, Class<T> type) { 1416 if (property == null) 1417 return null; 1418 switch (property) { 1419 case "format": return toType(getFormat(), type); 1420 case "title": return toType(getTitle(), type); 1421 case "description": return toType(getDescription(), type); 1422 case "default": return toType(getDefault(), type); 1423 case "multipleOf": return toType(getMultipleOf(), type); 1424 case "maximum": return toType(getMaximum(), type); 1425 case "exclusiveMaximum": return toType(getExclusiveMaximum(), type); 1426 case "minimum": return toType(getMinimum(), type); 1427 case "exclusiveMinimum": return toType(getExclusiveMinimum(), type); 1428 case "maxLength": return toType(getMaxLength(), type); 1429 case "minLength": return toType(getMinLength(), type); 1430 case "pattern": return toType(getPattern(), type); 1431 case "maxItems": return toType(getMaxItems(), type); 1432 case "minItems": return toType(getMinItems(), type); 1433 case "uniqueItems": return toType(getUniqueItems(), type); 1434 case "maxProperties": return toType(getMaxProperties(), type); 1435 case "minProperties": return toType(getMinProperties(), type); 1436 case "required": return toType(getRequired(), type); 1437 case "enum": return toType(getEnum(), type); 1438 case "type": return toType(getType(), type); 1439 case "items": return toType(getItems(), type); 1440 case "allOf": return toType(getAllOf(), type); 1441 case "properties": return toType(getProperties(), type); 1442 case "additionalProperties": return toType(getAdditionalProperties(), type); 1443 case "discriminator": return toType(getDiscriminator(), type); 1444 case "readOnly": return toType(getReadOnly(), type); 1445 case "xml": return toType(getXml(), type); 1446 case "externalDocs": return toType(getExternalDocs(), type); 1447 case "example": return toType(getExample(), type); 1448 case "$ref": return toType(getRef(), type); 1449 default: return super.get(property, type); 1450 } 1451 } 1452 1453 @Override /* SwaggerElement */ 1454 public SchemaInfo set(String property, Object value) { 1455 if (property == null) 1456 return this; 1457 switch (property) { 1458 case "format": return format(value); 1459 case "title": return title(value); 1460 case "description": return description(value); 1461 case "default": return _default(value); 1462 case "multipleOf": return multipleOf(value); 1463 case "maximum": return maximum(value); 1464 case "exclusiveMaximum": return exclusiveMaximum(value); 1465 case "minimum": return minimum(value); 1466 case "exclusiveMinimum": return exclusiveMinimum(value); 1467 case "maxLength": return maxLength(value); 1468 case "minLength": return minLength(value); 1469 case "pattern": return pattern(value); 1470 case "maxItems": return maxItems(value); 1471 case "minItems": return minItems(value); 1472 case "uniqueItems": return uniqueItems(value); 1473 case "maxProperties": return maxProperties(value); 1474 case "minProperties": return minProperties(value); 1475 case "required": return setRequired(null).required(value); 1476 case "enum": return setEnum(null)._enum(value); 1477 case "type": return type(value); 1478 case "items": return items(value); 1479 case "allOf": return setAllOf(null).allOf(value); 1480 case "properties": return setProperties(null).properties(value); 1481 case "additionalProperties": return additionalProperties(value); 1482 case "discriminator": return discriminator(value); 1483 case "readOnly": return readOnly(value); 1484 case "xml": return xml(value); 1485 case "externalDocs": return externalDocs(value); 1486 case "example": return example(value); 1487 case "$ref": return ref(value); 1488 default: 1489 super.set(property, value); 1490 return this; 1491 } 1492 } 1493 1494 @Override /* SwaggerElement */ 1495 public Set<String> keySet() { 1496 ASet<String> s = new ASet<String>() 1497 .appendIf(format != null, "format") 1498 .appendIf(title != null, "title") 1499 .appendIf(description != null, "description") 1500 .appendIf(_default != null, "default") 1501 .appendIf(multipleOf != null, "multipleOf") 1502 .appendIf(maximum != null, "maximum") 1503 .appendIf(exclusiveMaximum != null, "exclusiveMaximum") 1504 .appendIf(minimum != null, "minimum") 1505 .appendIf(exclusiveMinimum != null, "exclusiveMinimum") 1506 .appendIf(maxLength != null, "maxLength") 1507 .appendIf(minLength != null, "minLength") 1508 .appendIf(pattern != null, "pattern") 1509 .appendIf(maxItems != null, "maxItems") 1510 .appendIf(minItems != null, "minItems") 1511 .appendIf(uniqueItems != null, "uniqueItems") 1512 .appendIf(maxProperties != null, "maxProperties") 1513 .appendIf(minProperties != null, "minProperties") 1514 .appendIf(required != null, "required") 1515 .appendIf(_enum != null, "enum") 1516 .appendIf(type != null, "type") 1517 .appendIf(items != null, "items") 1518 .appendIf(allOf != null, "allOf") 1519 .appendIf(properties != null, "properties") 1520 .appendIf(additionalProperties != null, "additionalProperties") 1521 .appendIf(discriminator != null, "discriminator") 1522 .appendIf(readOnly != null, "readOnly") 1523 .appendIf(xml != null, "xml") 1524 .appendIf(externalDocs != null, "externalDocs") 1525 .appendIf(example != null, "example") 1526 .appendIf(ref != null, "$ref"); 1527 return new MultiSet<>(s, super.keySet()); 1528 } 1529 1530 1531 1532 /** 1533 * Returns <jk>true</jk> if this schema info has one or more properties defined on it. 1534 * 1535 * @return <jk>true</jk> if this schema info has one or more properties defined on it. 1536 */ 1537 public boolean hasProperties() { 1538 return properties != null && ! properties.isEmpty(); 1539 } 1540 1541 /** 1542 * Resolves any <js>"$ref"</js> attributes in this element. 1543 * 1544 * @param swagger The swagger document containing the definitions. 1545 * @param refStack Keeps track of previously-visited references so that we don't cause recursive loops. 1546 * @param maxDepth 1547 * The maximum depth to resolve references. 1548 * <br>After that level is reached, <code>$ref</code> references will be left alone. 1549 * <br>Useful if you have very complex models and you don't want your swagger page to be overly-complex. 1550 * @return 1551 * This object with references resolved. 1552 * <br>May or may not be the same object. 1553 */ 1554 public SchemaInfo resolveRefs(Swagger swagger, Deque<String> refStack, int maxDepth) { 1555 1556 if (ref != null) { 1557 if (refStack.contains(ref) || refStack.size() >= maxDepth) 1558 return this; 1559 refStack.addLast(ref); 1560 SchemaInfo r = swagger.findRef(ref, SchemaInfo.class).resolveRefs(swagger, refStack, maxDepth); 1561 refStack.removeLast(); 1562 return r; 1563 } 1564 1565 if (items != null) 1566 items = items.resolveRefs(swagger, refStack, maxDepth); 1567 1568 if (properties != null) 1569 for (Map.Entry<String,SchemaInfo> e : properties.entrySet()) 1570 e.setValue(e.getValue().resolveRefs(swagger, refStack, maxDepth)); 1571 1572 if (additionalProperties != null) 1573 additionalProperties = additionalProperties.resolveRefs(swagger, refStack, maxDepth); 1574 1575 this.example = null; 1576 1577 return this; 1578 } 1579}