Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.finbourne.horizon.model.JSchema Maven / Gradle / Ivy
/*
* FINBOURNE Horizon API
*
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.finbourne.horizon.model;
import java.util.Objects;
import com.finbourne.horizon.model.JSchemaType;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.finbourne.horizon.JSON;
/**
* JSchema
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class JSchema {
public static final String SERIALIZED_NAME_SCHEMA_VERSION = "schemaVersion";
@SerializedName(SERIALIZED_NAME_SCHEMA_VERSION)
private URI schemaVersion;
public static final String SERIALIZED_NAME_VALID = "valid";
@SerializedName(SERIALIZED_NAME_VALID)
private Boolean valid;
public static final String SERIALIZED_NAME_REFERENCE = "reference";
@SerializedName(SERIALIZED_NAME_REFERENCE)
private URI reference;
public static final String SERIALIZED_NAME_REF = "ref";
@SerializedName(SERIALIZED_NAME_REF)
private JSchema ref;
public static final String SERIALIZED_NAME_RECURSIVE_REFERENCE = "recursiveReference";
@SerializedName(SERIALIZED_NAME_RECURSIVE_REFERENCE)
private URI recursiveReference;
public static final String SERIALIZED_NAME_RECURSIVE_ANCHOR = "recursiveAnchor";
@SerializedName(SERIALIZED_NAME_RECURSIVE_ANCHOR)
private Boolean recursiveAnchor;
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private URI id;
public static final String SERIALIZED_NAME_ANCHOR = "anchor";
@SerializedName(SERIALIZED_NAME_ANCHOR)
private String anchor;
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private JSchemaType type;
public static final String SERIALIZED_NAME_DEFAULT = "default";
@SerializedName(SERIALIZED_NAME_DEFAULT)
private Object _default = null;
public static final String SERIALIZED_NAME_PROPERTIES = "properties";
@SerializedName(SERIALIZED_NAME_PROPERTIES)
private Map properties = new HashMap<>();
public static final String SERIALIZED_NAME_ITEMS = "items";
@SerializedName(SERIALIZED_NAME_ITEMS)
private List items = new ArrayList<>();
public static final String SERIALIZED_NAME_ITEMS_POSITION_VALIDATION = "itemsPositionValidation";
@SerializedName(SERIALIZED_NAME_ITEMS_POSITION_VALIDATION)
private Boolean itemsPositionValidation;
public static final String SERIALIZED_NAME_REQUIRED = "required";
@SerializedName(SERIALIZED_NAME_REQUIRED)
private List required = new ArrayList<>();
public static final String SERIALIZED_NAME_ALL_OF = "allOf";
@SerializedName(SERIALIZED_NAME_ALL_OF)
private List allOf = new ArrayList<>();
public static final String SERIALIZED_NAME_ANY_OF = "anyOf";
@SerializedName(SERIALIZED_NAME_ANY_OF)
private List anyOf = new ArrayList<>();
public static final String SERIALIZED_NAME_ONE_OF = "oneOf";
@SerializedName(SERIALIZED_NAME_ONE_OF)
private List oneOf = new ArrayList<>();
public static final String SERIALIZED_NAME_IF = "if";
@SerializedName(SERIALIZED_NAME_IF)
private JSchema _if;
public static final String SERIALIZED_NAME_THEN = "then";
@SerializedName(SERIALIZED_NAME_THEN)
private JSchema then;
public static final String SERIALIZED_NAME_ELSE = "else";
@SerializedName(SERIALIZED_NAME_ELSE)
private JSchema _else;
public static final String SERIALIZED_NAME_NOT = "not";
@SerializedName(SERIALIZED_NAME_NOT)
private JSchema not;
public static final String SERIALIZED_NAME_CONTAINS = "contains";
@SerializedName(SERIALIZED_NAME_CONTAINS)
private JSchema contains;
public static final String SERIALIZED_NAME_PROPERTY_NAMES = "propertyNames";
@SerializedName(SERIALIZED_NAME_PROPERTY_NAMES)
private JSchema propertyNames;
public static final String SERIALIZED_NAME_ENUM = "enum";
@SerializedName(SERIALIZED_NAME_ENUM)
private List _enum = new ArrayList<>();
public static final String SERIALIZED_NAME_CONST = "const";
@SerializedName(SERIALIZED_NAME_CONST)
private Object _const = null;
public static final String SERIALIZED_NAME_UNIQUE_ITEMS = "uniqueItems";
@SerializedName(SERIALIZED_NAME_UNIQUE_ITEMS)
private Boolean uniqueItems;
public static final String SERIALIZED_NAME_MINIMUM_LENGTH = "minimumLength";
@SerializedName(SERIALIZED_NAME_MINIMUM_LENGTH)
private Long minimumLength;
public static final String SERIALIZED_NAME_MAXIMUM_LENGTH = "maximumLength";
@SerializedName(SERIALIZED_NAME_MAXIMUM_LENGTH)
private Long maximumLength;
public static final String SERIALIZED_NAME_MINIMUM = "minimum";
@SerializedName(SERIALIZED_NAME_MINIMUM)
private java.math.BigDecimal minimum;
public static final String SERIALIZED_NAME_MAXIMUM = "maximum";
@SerializedName(SERIALIZED_NAME_MAXIMUM)
private java.math.BigDecimal maximum;
public static final String SERIALIZED_NAME_EXCLUSIVE_MINIMUM = "exclusiveMinimum";
@SerializedName(SERIALIZED_NAME_EXCLUSIVE_MINIMUM)
private Boolean exclusiveMinimum;
public static final String SERIALIZED_NAME_EXCLUSIVE_MAXIMUM = "exclusiveMaximum";
@SerializedName(SERIALIZED_NAME_EXCLUSIVE_MAXIMUM)
private Boolean exclusiveMaximum;
public static final String SERIALIZED_NAME_MINIMUM_ITEMS = "minimumItems";
@SerializedName(SERIALIZED_NAME_MINIMUM_ITEMS)
private Long minimumItems;
public static final String SERIALIZED_NAME_MAXIMUM_ITEMS = "maximumItems";
@SerializedName(SERIALIZED_NAME_MAXIMUM_ITEMS)
private Long maximumItems;
public static final String SERIALIZED_NAME_MINIMUM_PROPERTIES = "minimumProperties";
@SerializedName(SERIALIZED_NAME_MINIMUM_PROPERTIES)
private Long minimumProperties;
public static final String SERIALIZED_NAME_MAXIMUM_PROPERTIES = "maximumProperties";
@SerializedName(SERIALIZED_NAME_MAXIMUM_PROPERTIES)
private Long maximumProperties;
public static final String SERIALIZED_NAME_MINIMUM_CONTAINS = "minimumContains";
@SerializedName(SERIALIZED_NAME_MINIMUM_CONTAINS)
private Long minimumContains;
public static final String SERIALIZED_NAME_MAXIMUM_CONTAINS = "maximumContains";
@SerializedName(SERIALIZED_NAME_MAXIMUM_CONTAINS)
private Long maximumContains;
public static final String SERIALIZED_NAME_CONTENT_ENCODING = "contentEncoding";
@SerializedName(SERIALIZED_NAME_CONTENT_ENCODING)
private String contentEncoding;
public static final String SERIALIZED_NAME_CONTENT_MEDIA_TYPE = "contentMediaType";
@SerializedName(SERIALIZED_NAME_CONTENT_MEDIA_TYPE)
private String contentMediaType;
public static final String SERIALIZED_NAME_WRITE_ONLY = "writeOnly";
@SerializedName(SERIALIZED_NAME_WRITE_ONLY)
private Boolean writeOnly;
public static final String SERIALIZED_NAME_READ_ONLY = "readOnly";
@SerializedName(SERIALIZED_NAME_READ_ONLY)
private Boolean readOnly;
public static final String SERIALIZED_NAME_EXTENSION_DATA = "extensionData";
@SerializedName(SERIALIZED_NAME_EXTENSION_DATA)
private Map extensionData = new HashMap<>();
public static final String SERIALIZED_NAME_TITLE = "title";
@SerializedName(SERIALIZED_NAME_TITLE)
private String title;
public static final String SERIALIZED_NAME_DESCRIPTION = "description";
@SerializedName(SERIALIZED_NAME_DESCRIPTION)
private String description;
public static final String SERIALIZED_NAME_MULTIPLE_OF = "multipleOf";
@SerializedName(SERIALIZED_NAME_MULTIPLE_OF)
private java.math.BigDecimal multipleOf;
public static final String SERIALIZED_NAME_PATTERN = "pattern";
@SerializedName(SERIALIZED_NAME_PATTERN)
private String pattern;
public static final String SERIALIZED_NAME_DEPENDENCIES = "dependencies";
@SerializedName(SERIALIZED_NAME_DEPENDENCIES)
private Map dependencies = new HashMap<>();
public static final String SERIALIZED_NAME_DEPENDENT_REQUIRED = "dependentRequired";
@SerializedName(SERIALIZED_NAME_DEPENDENT_REQUIRED)
private Map> dependentRequired = new HashMap<>();
public static final String SERIALIZED_NAME_DEPENDENT_SCHEMAS = "dependentSchemas";
@SerializedName(SERIALIZED_NAME_DEPENDENT_SCHEMAS)
private Map dependentSchemas = new HashMap<>();
public static final String SERIALIZED_NAME_PATTERN_PROPERTIES = "patternProperties";
@SerializedName(SERIALIZED_NAME_PATTERN_PROPERTIES)
private Map patternProperties = new HashMap<>();
public static final String SERIALIZED_NAME_ADDITIONAL_PROPERTIES = "additionalProperties";
@SerializedName(SERIALIZED_NAME_ADDITIONAL_PROPERTIES)
private JSchema additionalProperties;
public static final String SERIALIZED_NAME_ALLOW_ADDITIONAL_PROPERTIES = "allowAdditionalProperties";
@SerializedName(SERIALIZED_NAME_ALLOW_ADDITIONAL_PROPERTIES)
private Boolean allowAdditionalProperties;
public static final String SERIALIZED_NAME_ALLOW_ADDITIONAL_PROPERTIES_SPECIFIED = "allowAdditionalPropertiesSpecified";
@SerializedName(SERIALIZED_NAME_ALLOW_ADDITIONAL_PROPERTIES_SPECIFIED)
private Boolean allowAdditionalPropertiesSpecified;
public static final String SERIALIZED_NAME_UNEVALUATED_PROPERTIES = "unevaluatedProperties";
@SerializedName(SERIALIZED_NAME_UNEVALUATED_PROPERTIES)
private JSchema unevaluatedProperties;
public static final String SERIALIZED_NAME_ALLOW_UNEVALUATED_PROPERTIES = "allowUnevaluatedProperties";
@SerializedName(SERIALIZED_NAME_ALLOW_UNEVALUATED_PROPERTIES)
private Boolean allowUnevaluatedProperties;
public static final String SERIALIZED_NAME_ADDITIONAL_ITEMS = "additionalItems";
@SerializedName(SERIALIZED_NAME_ADDITIONAL_ITEMS)
private JSchema additionalItems;
public static final String SERIALIZED_NAME_ALLOW_ADDITIONAL_ITEMS = "allowAdditionalItems";
@SerializedName(SERIALIZED_NAME_ALLOW_ADDITIONAL_ITEMS)
private Boolean allowAdditionalItems;
public static final String SERIALIZED_NAME_ALLOW_ADDITIONAL_ITEMS_SPECIFIED = "allowAdditionalItemsSpecified";
@SerializedName(SERIALIZED_NAME_ALLOW_ADDITIONAL_ITEMS_SPECIFIED)
private Boolean allowAdditionalItemsSpecified;
public static final String SERIALIZED_NAME_UNEVALUATED_ITEMS = "unevaluatedItems";
@SerializedName(SERIALIZED_NAME_UNEVALUATED_ITEMS)
private JSchema unevaluatedItems;
public static final String SERIALIZED_NAME_ALLOW_UNEVALUATED_ITEMS = "allowUnevaluatedItems";
@SerializedName(SERIALIZED_NAME_ALLOW_UNEVALUATED_ITEMS)
private Boolean allowUnevaluatedItems;
public static final String SERIALIZED_NAME_FORMAT = "format";
@SerializedName(SERIALIZED_NAME_FORMAT)
private String format;
public static final String SERIALIZED_NAME_VALIDATORS = "validators";
@SerializedName(SERIALIZED_NAME_VALIDATORS)
private List validators = new ArrayList<>();
public JSchema() {
}
public JSchema(
Map properties,
List items,
List required,
List allOf,
List anyOf,
List oneOf,
List _enum,
Map extensionData,
Map dependencies,
Map> dependentRequired,
Map dependentSchemas,
Map patternProperties,
List validators
) {
this();
this.properties = properties;
this.items = items;
this.required = required;
this.allOf = allOf;
this.anyOf = anyOf;
this.oneOf = oneOf;
this._enum = _enum;
this.extensionData = extensionData;
this.dependencies = dependencies;
this.dependentRequired = dependentRequired;
this.dependentSchemas = dependentSchemas;
this.patternProperties = patternProperties;
this.validators = validators;
}
public JSchema schemaVersion(URI schemaVersion) {
this.schemaVersion = schemaVersion;
return this;
}
/**
* Get schemaVersion
* @return schemaVersion
**/
@jakarta.annotation.Nullable
public URI getSchemaVersion() {
return schemaVersion;
}
public void setSchemaVersion(URI schemaVersion) {
this.schemaVersion = schemaVersion;
}
public JSchema valid(Boolean valid) {
this.valid = valid;
return this;
}
/**
* Get valid
* @return valid
**/
@jakarta.annotation.Nullable
public Boolean getValid() {
return valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
public JSchema reference(URI reference) {
this.reference = reference;
return this;
}
/**
* Get reference
* @return reference
**/
@jakarta.annotation.Nullable
public URI getReference() {
return reference;
}
public void setReference(URI reference) {
this.reference = reference;
}
public JSchema ref(JSchema ref) {
this.ref = ref;
return this;
}
/**
* Get ref
* @return ref
**/
@jakarta.annotation.Nullable
public JSchema getRef() {
return ref;
}
public void setRef(JSchema ref) {
this.ref = ref;
}
public JSchema recursiveReference(URI recursiveReference) {
this.recursiveReference = recursiveReference;
return this;
}
/**
* Get recursiveReference
* @return recursiveReference
**/
@jakarta.annotation.Nullable
public URI getRecursiveReference() {
return recursiveReference;
}
public void setRecursiveReference(URI recursiveReference) {
this.recursiveReference = recursiveReference;
}
public JSchema recursiveAnchor(Boolean recursiveAnchor) {
this.recursiveAnchor = recursiveAnchor;
return this;
}
/**
* Get recursiveAnchor
* @return recursiveAnchor
**/
@jakarta.annotation.Nullable
public Boolean getRecursiveAnchor() {
return recursiveAnchor;
}
public void setRecursiveAnchor(Boolean recursiveAnchor) {
this.recursiveAnchor = recursiveAnchor;
}
public JSchema id(URI id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
@jakarta.annotation.Nullable
public URI getId() {
return id;
}
public void setId(URI id) {
this.id = id;
}
public JSchema anchor(String anchor) {
this.anchor = anchor;
return this;
}
/**
* Get anchor
* @return anchor
**/
@jakarta.annotation.Nullable
public String getAnchor() {
return anchor;
}
public void setAnchor(String anchor) {
this.anchor = anchor;
}
public JSchema type(JSchemaType type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
**/
@jakarta.annotation.Nullable
public JSchemaType getType() {
return type;
}
public void setType(JSchemaType type) {
this.type = type;
}
public JSchema _default(Object _default) {
this._default = _default;
return this;
}
/**
* Get _default
* @return _default
**/
@jakarta.annotation.Nullable
public Object getDefault() {
return _default;
}
public void setDefault(Object _default) {
this._default = _default;
}
/**
* Get properties
* @return properties
**/
@jakarta.annotation.Nonnull
public Map getProperties() {
return properties;
}
/**
* Get items
* @return items
**/
@jakarta.annotation.Nonnull
public List getItems() {
return items;
}
public JSchema itemsPositionValidation(Boolean itemsPositionValidation) {
this.itemsPositionValidation = itemsPositionValidation;
return this;
}
/**
* Get itemsPositionValidation
* @return itemsPositionValidation
**/
@jakarta.annotation.Nonnull
public Boolean getItemsPositionValidation() {
return itemsPositionValidation;
}
public void setItemsPositionValidation(Boolean itemsPositionValidation) {
this.itemsPositionValidation = itemsPositionValidation;
}
/**
* Get required
* @return required
**/
@jakarta.annotation.Nonnull
public List getRequired() {
return required;
}
/**
* Get allOf
* @return allOf
**/
@jakarta.annotation.Nonnull
public List getAllOf() {
return allOf;
}
/**
* Get anyOf
* @return anyOf
**/
@jakarta.annotation.Nonnull
public List getAnyOf() {
return anyOf;
}
/**
* Get oneOf
* @return oneOf
**/
@jakarta.annotation.Nonnull
public List getOneOf() {
return oneOf;
}
public JSchema _if(JSchema _if) {
this._if = _if;
return this;
}
/**
* Get _if
* @return _if
**/
@jakarta.annotation.Nullable
public JSchema getIf() {
return _if;
}
public void setIf(JSchema _if) {
this._if = _if;
}
public JSchema then(JSchema then) {
this.then = then;
return this;
}
/**
* Get then
* @return then
**/
@jakarta.annotation.Nullable
public JSchema getThen() {
return then;
}
public void setThen(JSchema then) {
this.then = then;
}
public JSchema _else(JSchema _else) {
this._else = _else;
return this;
}
/**
* Get _else
* @return _else
**/
@jakarta.annotation.Nullable
public JSchema getElse() {
return _else;
}
public void setElse(JSchema _else) {
this._else = _else;
}
public JSchema not(JSchema not) {
this.not = not;
return this;
}
/**
* Get not
* @return not
**/
@jakarta.annotation.Nullable
public JSchema getNot() {
return not;
}
public void setNot(JSchema not) {
this.not = not;
}
public JSchema contains(JSchema contains) {
this.contains = contains;
return this;
}
/**
* Get contains
* @return contains
**/
@jakarta.annotation.Nullable
public JSchema getContains() {
return contains;
}
public void setContains(JSchema contains) {
this.contains = contains;
}
public JSchema propertyNames(JSchema propertyNames) {
this.propertyNames = propertyNames;
return this;
}
/**
* Get propertyNames
* @return propertyNames
**/
@jakarta.annotation.Nullable
public JSchema getPropertyNames() {
return propertyNames;
}
public void setPropertyNames(JSchema propertyNames) {
this.propertyNames = propertyNames;
}
/**
* Get _enum
* @return _enum
**/
@jakarta.annotation.Nonnull
public List getEnum() {
return _enum;
}
public JSchema _const(Object _const) {
this._const = _const;
return this;
}
/**
* Get _const
* @return _const
**/
@jakarta.annotation.Nullable
public Object getConst() {
return _const;
}
public void setConst(Object _const) {
this._const = _const;
}
public JSchema uniqueItems(Boolean uniqueItems) {
this.uniqueItems = uniqueItems;
return this;
}
/**
* Get uniqueItems
* @return uniqueItems
**/
@jakarta.annotation.Nonnull
public Boolean getUniqueItems() {
return uniqueItems;
}
public void setUniqueItems(Boolean uniqueItems) {
this.uniqueItems = uniqueItems;
}
public JSchema minimumLength(Long minimumLength) {
this.minimumLength = minimumLength;
return this;
}
/**
* Get minimumLength
* @return minimumLength
**/
@jakarta.annotation.Nullable
public Long getMinimumLength() {
return minimumLength;
}
public void setMinimumLength(Long minimumLength) {
this.minimumLength = minimumLength;
}
public JSchema maximumLength(Long maximumLength) {
this.maximumLength = maximumLength;
return this;
}
/**
* Get maximumLength
* @return maximumLength
**/
@jakarta.annotation.Nullable
public Long getMaximumLength() {
return maximumLength;
}
public void setMaximumLength(Long maximumLength) {
this.maximumLength = maximumLength;
}
public JSchema minimum(java.math.BigDecimal minimum) {
this.minimum = minimum;
return this;
}
/**
* Get minimum
* @return minimum
**/
@jakarta.annotation.Nullable
public java.math.BigDecimal getMinimum() {
return minimum;
}
public void setMinimum(java.math.BigDecimal minimum) {
this.minimum = minimum;
}
public JSchema maximum(java.math.BigDecimal maximum) {
this.maximum = maximum;
return this;
}
/**
* Get maximum
* @return maximum
**/
@jakarta.annotation.Nullable
public java.math.BigDecimal getMaximum() {
return maximum;
}
public void setMaximum(java.math.BigDecimal maximum) {
this.maximum = maximum;
}
public JSchema exclusiveMinimum(Boolean exclusiveMinimum) {
this.exclusiveMinimum = exclusiveMinimum;
return this;
}
/**
* Get exclusiveMinimum
* @return exclusiveMinimum
**/
@jakarta.annotation.Nonnull
public Boolean getExclusiveMinimum() {
return exclusiveMinimum;
}
public void setExclusiveMinimum(Boolean exclusiveMinimum) {
this.exclusiveMinimum = exclusiveMinimum;
}
public JSchema exclusiveMaximum(Boolean exclusiveMaximum) {
this.exclusiveMaximum = exclusiveMaximum;
return this;
}
/**
* Get exclusiveMaximum
* @return exclusiveMaximum
**/
@jakarta.annotation.Nonnull
public Boolean getExclusiveMaximum() {
return exclusiveMaximum;
}
public void setExclusiveMaximum(Boolean exclusiveMaximum) {
this.exclusiveMaximum = exclusiveMaximum;
}
public JSchema minimumItems(Long minimumItems) {
this.minimumItems = minimumItems;
return this;
}
/**
* Get minimumItems
* @return minimumItems
**/
@jakarta.annotation.Nullable
public Long getMinimumItems() {
return minimumItems;
}
public void setMinimumItems(Long minimumItems) {
this.minimumItems = minimumItems;
}
public JSchema maximumItems(Long maximumItems) {
this.maximumItems = maximumItems;
return this;
}
/**
* Get maximumItems
* @return maximumItems
**/
@jakarta.annotation.Nullable
public Long getMaximumItems() {
return maximumItems;
}
public void setMaximumItems(Long maximumItems) {
this.maximumItems = maximumItems;
}
public JSchema minimumProperties(Long minimumProperties) {
this.minimumProperties = minimumProperties;
return this;
}
/**
* Get minimumProperties
* @return minimumProperties
**/
@jakarta.annotation.Nullable
public Long getMinimumProperties() {
return minimumProperties;
}
public void setMinimumProperties(Long minimumProperties) {
this.minimumProperties = minimumProperties;
}
public JSchema maximumProperties(Long maximumProperties) {
this.maximumProperties = maximumProperties;
return this;
}
/**
* Get maximumProperties
* @return maximumProperties
**/
@jakarta.annotation.Nullable
public Long getMaximumProperties() {
return maximumProperties;
}
public void setMaximumProperties(Long maximumProperties) {
this.maximumProperties = maximumProperties;
}
public JSchema minimumContains(Long minimumContains) {
this.minimumContains = minimumContains;
return this;
}
/**
* Get minimumContains
* @return minimumContains
**/
@jakarta.annotation.Nullable
public Long getMinimumContains() {
return minimumContains;
}
public void setMinimumContains(Long minimumContains) {
this.minimumContains = minimumContains;
}
public JSchema maximumContains(Long maximumContains) {
this.maximumContains = maximumContains;
return this;
}
/**
* Get maximumContains
* @return maximumContains
**/
@jakarta.annotation.Nullable
public Long getMaximumContains() {
return maximumContains;
}
public void setMaximumContains(Long maximumContains) {
this.maximumContains = maximumContains;
}
public JSchema contentEncoding(String contentEncoding) {
this.contentEncoding = contentEncoding;
return this;
}
/**
* Get contentEncoding
* @return contentEncoding
**/
@jakarta.annotation.Nullable
public String getContentEncoding() {
return contentEncoding;
}
public void setContentEncoding(String contentEncoding) {
this.contentEncoding = contentEncoding;
}
public JSchema contentMediaType(String contentMediaType) {
this.contentMediaType = contentMediaType;
return this;
}
/**
* Get contentMediaType
* @return contentMediaType
**/
@jakarta.annotation.Nullable
public String getContentMediaType() {
return contentMediaType;
}
public void setContentMediaType(String contentMediaType) {
this.contentMediaType = contentMediaType;
}
public JSchema writeOnly(Boolean writeOnly) {
this.writeOnly = writeOnly;
return this;
}
/**
* Get writeOnly
* @return writeOnly
**/
@jakarta.annotation.Nullable
public Boolean getWriteOnly() {
return writeOnly;
}
public void setWriteOnly(Boolean writeOnly) {
this.writeOnly = writeOnly;
}
public JSchema readOnly(Boolean readOnly) {
this.readOnly = readOnly;
return this;
}
/**
* Get readOnly
* @return readOnly
**/
@jakarta.annotation.Nullable
public Boolean getReadOnly() {
return readOnly;
}
public void setReadOnly(Boolean readOnly) {
this.readOnly = readOnly;
}
/**
* Get extensionData
* @return extensionData
**/
@jakarta.annotation.Nonnull
public Map getExtensionData() {
return extensionData;
}
public JSchema title(String title) {
this.title = title;
return this;
}
/**
* Get title
* @return title
**/
@jakarta.annotation.Nullable
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public JSchema description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
**/
@jakarta.annotation.Nullable
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public JSchema multipleOf(java.math.BigDecimal multipleOf) {
this.multipleOf = multipleOf;
return this;
}
/**
* Get multipleOf
* @return multipleOf
**/
@jakarta.annotation.Nullable
public java.math.BigDecimal getMultipleOf() {
return multipleOf;
}
public void setMultipleOf(java.math.BigDecimal multipleOf) {
this.multipleOf = multipleOf;
}
public JSchema pattern(String pattern) {
this.pattern = pattern;
return this;
}
/**
* Get pattern
* @return pattern
**/
@jakarta.annotation.Nullable
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
/**
* Get dependencies
* @return dependencies
**/
@jakarta.annotation.Nonnull
public Map getDependencies() {
return dependencies;
}
/**
* Get dependentRequired
* @return dependentRequired
**/
@jakarta.annotation.Nonnull
public Map> getDependentRequired() {
return dependentRequired;
}
/**
* Get dependentSchemas
* @return dependentSchemas
**/
@jakarta.annotation.Nonnull
public Map getDependentSchemas() {
return dependentSchemas;
}
/**
* Get patternProperties
* @return patternProperties
**/
@jakarta.annotation.Nonnull
public Map getPatternProperties() {
return patternProperties;
}
public JSchema additionalProperties(JSchema additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
}
/**
* Get additionalProperties
* @return additionalProperties
**/
@jakarta.annotation.Nullable
public JSchema getAdditionalProperties() {
return additionalProperties;
}
public void setAdditionalProperties(JSchema additionalProperties) {
this.additionalProperties = additionalProperties;
}
public JSchema allowAdditionalProperties(Boolean allowAdditionalProperties) {
this.allowAdditionalProperties = allowAdditionalProperties;
return this;
}
/**
* Get allowAdditionalProperties
* @return allowAdditionalProperties
**/
@jakarta.annotation.Nonnull
public Boolean getAllowAdditionalProperties() {
return allowAdditionalProperties;
}
public void setAllowAdditionalProperties(Boolean allowAdditionalProperties) {
this.allowAdditionalProperties = allowAdditionalProperties;
}
public JSchema allowAdditionalPropertiesSpecified(Boolean allowAdditionalPropertiesSpecified) {
this.allowAdditionalPropertiesSpecified = allowAdditionalPropertiesSpecified;
return this;
}
/**
* Get allowAdditionalPropertiesSpecified
* @return allowAdditionalPropertiesSpecified
**/
@jakarta.annotation.Nonnull
public Boolean getAllowAdditionalPropertiesSpecified() {
return allowAdditionalPropertiesSpecified;
}
public void setAllowAdditionalPropertiesSpecified(Boolean allowAdditionalPropertiesSpecified) {
this.allowAdditionalPropertiesSpecified = allowAdditionalPropertiesSpecified;
}
public JSchema unevaluatedProperties(JSchema unevaluatedProperties) {
this.unevaluatedProperties = unevaluatedProperties;
return this;
}
/**
* Get unevaluatedProperties
* @return unevaluatedProperties
**/
@jakarta.annotation.Nullable
public JSchema getUnevaluatedProperties() {
return unevaluatedProperties;
}
public void setUnevaluatedProperties(JSchema unevaluatedProperties) {
this.unevaluatedProperties = unevaluatedProperties;
}
public JSchema allowUnevaluatedProperties(Boolean allowUnevaluatedProperties) {
this.allowUnevaluatedProperties = allowUnevaluatedProperties;
return this;
}
/**
* Get allowUnevaluatedProperties
* @return allowUnevaluatedProperties
**/
@jakarta.annotation.Nullable
public Boolean getAllowUnevaluatedProperties() {
return allowUnevaluatedProperties;
}
public void setAllowUnevaluatedProperties(Boolean allowUnevaluatedProperties) {
this.allowUnevaluatedProperties = allowUnevaluatedProperties;
}
public JSchema additionalItems(JSchema additionalItems) {
this.additionalItems = additionalItems;
return this;
}
/**
* Get additionalItems
* @return additionalItems
**/
@jakarta.annotation.Nullable
public JSchema getAdditionalItems() {
return additionalItems;
}
public void setAdditionalItems(JSchema additionalItems) {
this.additionalItems = additionalItems;
}
public JSchema allowAdditionalItems(Boolean allowAdditionalItems) {
this.allowAdditionalItems = allowAdditionalItems;
return this;
}
/**
* Get allowAdditionalItems
* @return allowAdditionalItems
**/
@jakarta.annotation.Nonnull
public Boolean getAllowAdditionalItems() {
return allowAdditionalItems;
}
public void setAllowAdditionalItems(Boolean allowAdditionalItems) {
this.allowAdditionalItems = allowAdditionalItems;
}
public JSchema allowAdditionalItemsSpecified(Boolean allowAdditionalItemsSpecified) {
this.allowAdditionalItemsSpecified = allowAdditionalItemsSpecified;
return this;
}
/**
* Get allowAdditionalItemsSpecified
* @return allowAdditionalItemsSpecified
**/
@jakarta.annotation.Nonnull
public Boolean getAllowAdditionalItemsSpecified() {
return allowAdditionalItemsSpecified;
}
public void setAllowAdditionalItemsSpecified(Boolean allowAdditionalItemsSpecified) {
this.allowAdditionalItemsSpecified = allowAdditionalItemsSpecified;
}
public JSchema unevaluatedItems(JSchema unevaluatedItems) {
this.unevaluatedItems = unevaluatedItems;
return this;
}
/**
* Get unevaluatedItems
* @return unevaluatedItems
**/
@jakarta.annotation.Nullable
public JSchema getUnevaluatedItems() {
return unevaluatedItems;
}
public void setUnevaluatedItems(JSchema unevaluatedItems) {
this.unevaluatedItems = unevaluatedItems;
}
public JSchema allowUnevaluatedItems(Boolean allowUnevaluatedItems) {
this.allowUnevaluatedItems = allowUnevaluatedItems;
return this;
}
/**
* Get allowUnevaluatedItems
* @return allowUnevaluatedItems
**/
@jakarta.annotation.Nullable
public Boolean getAllowUnevaluatedItems() {
return allowUnevaluatedItems;
}
public void setAllowUnevaluatedItems(Boolean allowUnevaluatedItems) {
this.allowUnevaluatedItems = allowUnevaluatedItems;
}
public JSchema format(String format) {
this.format = format;
return this;
}
/**
* Get format
* @return format
**/
@jakarta.annotation.Nullable
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
/**
* Get validators
* @return validators
**/
@jakarta.annotation.Nonnull
public List getValidators() {
return validators;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JSchema jschema = (JSchema) o;
return Objects.equals(this.schemaVersion, jschema.schemaVersion) &&
Objects.equals(this.valid, jschema.valid) &&
Objects.equals(this.reference, jschema.reference) &&
Objects.equals(this.ref, jschema.ref) &&
Objects.equals(this.recursiveReference, jschema.recursiveReference) &&
Objects.equals(this.recursiveAnchor, jschema.recursiveAnchor) &&
Objects.equals(this.id, jschema.id) &&
Objects.equals(this.anchor, jschema.anchor) &&
Objects.equals(this.type, jschema.type) &&
Objects.equals(this._default, jschema._default) &&
Objects.equals(this.properties, jschema.properties) &&
Objects.equals(this.items, jschema.items) &&
Objects.equals(this.itemsPositionValidation, jschema.itemsPositionValidation) &&
Objects.equals(this.required, jschema.required) &&
Objects.equals(this.allOf, jschema.allOf) &&
Objects.equals(this.anyOf, jschema.anyOf) &&
Objects.equals(this.oneOf, jschema.oneOf) &&
Objects.equals(this._if, jschema._if) &&
Objects.equals(this.then, jschema.then) &&
Objects.equals(this._else, jschema._else) &&
Objects.equals(this.not, jschema.not) &&
Objects.equals(this.contains, jschema.contains) &&
Objects.equals(this.propertyNames, jschema.propertyNames) &&
Objects.equals(this._enum, jschema._enum) &&
Objects.equals(this._const, jschema._const) &&
Objects.equals(this.uniqueItems, jschema.uniqueItems) &&
Objects.equals(this.minimumLength, jschema.minimumLength) &&
Objects.equals(this.maximumLength, jschema.maximumLength) &&
(this.minimum.compareTo(jschema.getMinimum()) == 0) &&
(this.maximum.compareTo(jschema.getMaximum()) == 0) &&
Objects.equals(this.exclusiveMinimum, jschema.exclusiveMinimum) &&
Objects.equals(this.exclusiveMaximum, jschema.exclusiveMaximum) &&
Objects.equals(this.minimumItems, jschema.minimumItems) &&
Objects.equals(this.maximumItems, jschema.maximumItems) &&
Objects.equals(this.minimumProperties, jschema.minimumProperties) &&
Objects.equals(this.maximumProperties, jschema.maximumProperties) &&
Objects.equals(this.minimumContains, jschema.minimumContains) &&
Objects.equals(this.maximumContains, jschema.maximumContains) &&
Objects.equals(this.contentEncoding, jschema.contentEncoding) &&
Objects.equals(this.contentMediaType, jschema.contentMediaType) &&
Objects.equals(this.writeOnly, jschema.writeOnly) &&
Objects.equals(this.readOnly, jschema.readOnly) &&
Objects.equals(this.extensionData, jschema.extensionData) &&
Objects.equals(this.title, jschema.title) &&
Objects.equals(this.description, jschema.description) &&
(this.multipleOf.compareTo(jschema.getMultipleOf()) == 0) &&
Objects.equals(this.pattern, jschema.pattern) &&
Objects.equals(this.dependencies, jschema.dependencies) &&
Objects.equals(this.dependentRequired, jschema.dependentRequired) &&
Objects.equals(this.dependentSchemas, jschema.dependentSchemas) &&
Objects.equals(this.patternProperties, jschema.patternProperties) &&
Objects.equals(this.additionalProperties, jschema.additionalProperties) &&
Objects.equals(this.allowAdditionalProperties, jschema.allowAdditionalProperties) &&
Objects.equals(this.allowAdditionalPropertiesSpecified, jschema.allowAdditionalPropertiesSpecified) &&
Objects.equals(this.unevaluatedProperties, jschema.unevaluatedProperties) &&
Objects.equals(this.allowUnevaluatedProperties, jschema.allowUnevaluatedProperties) &&
Objects.equals(this.additionalItems, jschema.additionalItems) &&
Objects.equals(this.allowAdditionalItems, jschema.allowAdditionalItems) &&
Objects.equals(this.allowAdditionalItemsSpecified, jschema.allowAdditionalItemsSpecified) &&
Objects.equals(this.unevaluatedItems, jschema.unevaluatedItems) &&
Objects.equals(this.allowUnevaluatedItems, jschema.allowUnevaluatedItems) &&
Objects.equals(this.format, jschema.format) &&
Objects.equals(this.validators, jschema.validators);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(schemaVersion, valid, reference, ref, recursiveReference, recursiveAnchor, id, anchor, type, _default, properties, items, itemsPositionValidation, required, allOf, anyOf, oneOf, _if, then, _else, not, contains, propertyNames, _enum, _const, uniqueItems, minimumLength, maximumLength, minimum, maximum, exclusiveMinimum, exclusiveMaximum, minimumItems, maximumItems, minimumProperties, maximumProperties, minimumContains, maximumContains, contentEncoding, contentMediaType, writeOnly, readOnly, extensionData, title, description, multipleOf, pattern, dependencies, dependentRequired, dependentSchemas, patternProperties, additionalProperties, allowAdditionalProperties, allowAdditionalPropertiesSpecified, unevaluatedProperties, allowUnevaluatedProperties, additionalItems, allowAdditionalItems, allowAdditionalItemsSpecified, unevaluatedItems, allowUnevaluatedItems, format, validators);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class JSchema {\n");
sb.append(" schemaVersion: ").append(toIndentedString(schemaVersion)).append("\n");
sb.append(" valid: ").append(toIndentedString(valid)).append("\n");
sb.append(" reference: ").append(toIndentedString(reference)).append("\n");
sb.append(" ref: ").append(toIndentedString(ref)).append("\n");
sb.append(" recursiveReference: ").append(toIndentedString(recursiveReference)).append("\n");
sb.append(" recursiveAnchor: ").append(toIndentedString(recursiveAnchor)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" anchor: ").append(toIndentedString(anchor)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" _default: ").append(toIndentedString(_default)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
sb.append(" items: ").append(toIndentedString(items)).append("\n");
sb.append(" itemsPositionValidation: ").append(toIndentedString(itemsPositionValidation)).append("\n");
sb.append(" required: ").append(toIndentedString(required)).append("\n");
sb.append(" allOf: ").append(toIndentedString(allOf)).append("\n");
sb.append(" anyOf: ").append(toIndentedString(anyOf)).append("\n");
sb.append(" oneOf: ").append(toIndentedString(oneOf)).append("\n");
sb.append(" _if: ").append(toIndentedString(_if)).append("\n");
sb.append(" then: ").append(toIndentedString(then)).append("\n");
sb.append(" _else: ").append(toIndentedString(_else)).append("\n");
sb.append(" not: ").append(toIndentedString(not)).append("\n");
sb.append(" contains: ").append(toIndentedString(contains)).append("\n");
sb.append(" propertyNames: ").append(toIndentedString(propertyNames)).append("\n");
sb.append(" _enum: ").append(toIndentedString(_enum)).append("\n");
sb.append(" _const: ").append(toIndentedString(_const)).append("\n");
sb.append(" uniqueItems: ").append(toIndentedString(uniqueItems)).append("\n");
sb.append(" minimumLength: ").append(toIndentedString(minimumLength)).append("\n");
sb.append(" maximumLength: ").append(toIndentedString(maximumLength)).append("\n");
sb.append(" minimum: ").append(toIndentedString(minimum)).append("\n");
sb.append(" maximum: ").append(toIndentedString(maximum)).append("\n");
sb.append(" exclusiveMinimum: ").append(toIndentedString(exclusiveMinimum)).append("\n");
sb.append(" exclusiveMaximum: ").append(toIndentedString(exclusiveMaximum)).append("\n");
sb.append(" minimumItems: ").append(toIndentedString(minimumItems)).append("\n");
sb.append(" maximumItems: ").append(toIndentedString(maximumItems)).append("\n");
sb.append(" minimumProperties: ").append(toIndentedString(minimumProperties)).append("\n");
sb.append(" maximumProperties: ").append(toIndentedString(maximumProperties)).append("\n");
sb.append(" minimumContains: ").append(toIndentedString(minimumContains)).append("\n");
sb.append(" maximumContains: ").append(toIndentedString(maximumContains)).append("\n");
sb.append(" contentEncoding: ").append(toIndentedString(contentEncoding)).append("\n");
sb.append(" contentMediaType: ").append(toIndentedString(contentMediaType)).append("\n");
sb.append(" writeOnly: ").append(toIndentedString(writeOnly)).append("\n");
sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n");
sb.append(" extensionData: ").append(toIndentedString(extensionData)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" multipleOf: ").append(toIndentedString(multipleOf)).append("\n");
sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n");
sb.append(" dependencies: ").append(toIndentedString(dependencies)).append("\n");
sb.append(" dependentRequired: ").append(toIndentedString(dependentRequired)).append("\n");
sb.append(" dependentSchemas: ").append(toIndentedString(dependentSchemas)).append("\n");
sb.append(" patternProperties: ").append(toIndentedString(patternProperties)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append(" allowAdditionalProperties: ").append(toIndentedString(allowAdditionalProperties)).append("\n");
sb.append(" allowAdditionalPropertiesSpecified: ").append(toIndentedString(allowAdditionalPropertiesSpecified)).append("\n");
sb.append(" unevaluatedProperties: ").append(toIndentedString(unevaluatedProperties)).append("\n");
sb.append(" allowUnevaluatedProperties: ").append(toIndentedString(allowUnevaluatedProperties)).append("\n");
sb.append(" additionalItems: ").append(toIndentedString(additionalItems)).append("\n");
sb.append(" allowAdditionalItems: ").append(toIndentedString(allowAdditionalItems)).append("\n");
sb.append(" allowAdditionalItemsSpecified: ").append(toIndentedString(allowAdditionalItemsSpecified)).append("\n");
sb.append(" unevaluatedItems: ").append(toIndentedString(unevaluatedItems)).append("\n");
sb.append(" allowUnevaluatedItems: ").append(toIndentedString(allowUnevaluatedItems)).append("\n");
sb.append(" format: ").append(toIndentedString(format)).append("\n");
sb.append(" validators: ").append(toIndentedString(validators)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("schemaVersion");
openapiFields.add("valid");
openapiFields.add("reference");
openapiFields.add("ref");
openapiFields.add("recursiveReference");
openapiFields.add("recursiveAnchor");
openapiFields.add("id");
openapiFields.add("anchor");
openapiFields.add("type");
openapiFields.add("default");
openapiFields.add("properties");
openapiFields.add("items");
openapiFields.add("itemsPositionValidation");
openapiFields.add("required");
openapiFields.add("allOf");
openapiFields.add("anyOf");
openapiFields.add("oneOf");
openapiFields.add("if");
openapiFields.add("then");
openapiFields.add("else");
openapiFields.add("not");
openapiFields.add("contains");
openapiFields.add("propertyNames");
openapiFields.add("enum");
openapiFields.add("const");
openapiFields.add("uniqueItems");
openapiFields.add("minimumLength");
openapiFields.add("maximumLength");
openapiFields.add("minimum");
openapiFields.add("maximum");
openapiFields.add("exclusiveMinimum");
openapiFields.add("exclusiveMaximum");
openapiFields.add("minimumItems");
openapiFields.add("maximumItems");
openapiFields.add("minimumProperties");
openapiFields.add("maximumProperties");
openapiFields.add("minimumContains");
openapiFields.add("maximumContains");
openapiFields.add("contentEncoding");
openapiFields.add("contentMediaType");
openapiFields.add("writeOnly");
openapiFields.add("readOnly");
openapiFields.add("extensionData");
openapiFields.add("title");
openapiFields.add("description");
openapiFields.add("multipleOf");
openapiFields.add("pattern");
openapiFields.add("dependencies");
openapiFields.add("dependentRequired");
openapiFields.add("dependentSchemas");
openapiFields.add("patternProperties");
openapiFields.add("additionalProperties");
openapiFields.add("allowAdditionalProperties");
openapiFields.add("allowAdditionalPropertiesSpecified");
openapiFields.add("unevaluatedProperties");
openapiFields.add("allowUnevaluatedProperties");
openapiFields.add("additionalItems");
openapiFields.add("allowAdditionalItems");
openapiFields.add("allowAdditionalItemsSpecified");
openapiFields.add("unevaluatedItems");
openapiFields.add("allowUnevaluatedItems");
openapiFields.add("format");
openapiFields.add("validators");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("properties");
openapiRequiredFields.add("items");
openapiRequiredFields.add("itemsPositionValidation");
openapiRequiredFields.add("required");
openapiRequiredFields.add("allOf");
openapiRequiredFields.add("anyOf");
openapiRequiredFields.add("oneOf");
openapiRequiredFields.add("enum");
openapiRequiredFields.add("uniqueItems");
openapiRequiredFields.add("exclusiveMinimum");
openapiRequiredFields.add("exclusiveMaximum");
openapiRequiredFields.add("extensionData");
openapiRequiredFields.add("dependencies");
openapiRequiredFields.add("dependentRequired");
openapiRequiredFields.add("dependentSchemas");
openapiRequiredFields.add("patternProperties");
openapiRequiredFields.add("allowAdditionalProperties");
openapiRequiredFields.add("allowAdditionalPropertiesSpecified");
openapiRequiredFields.add("allowAdditionalItems");
openapiRequiredFields.add("allowAdditionalItemsSpecified");
openapiRequiredFields.add("validators");
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to JSchema
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!JSchema.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in JSchema is not found in the empty JSON string", JSchema.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : JSchema.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("schemaVersion") != null && !jsonObj.get("schemaVersion").isJsonNull()) && !jsonObj.get("schemaVersion").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `schemaVersion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaVersion").toString()));
}
if ((jsonObj.get("reference") != null && !jsonObj.get("reference").isJsonNull()) && !jsonObj.get("reference").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString()));
}
// validate the optional field `ref`
if (jsonObj.get("ref") != null && !jsonObj.get("ref").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("ref"));
}
if ((jsonObj.get("recursiveReference") != null && !jsonObj.get("recursiveReference").isJsonNull()) && !jsonObj.get("recursiveReference").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `recursiveReference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recursiveReference").toString()));
}
if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
}
if ((jsonObj.get("anchor") != null && !jsonObj.get("anchor").isJsonNull()) && !jsonObj.get("anchor").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `anchor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("anchor").toString()));
}
// ensure the json data is an array
if (!jsonObj.get("items").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString()));
}
JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items");
// validate the required field `items` (array)
for (int i = 0; i < jsonArrayitems.size(); i++) {
JSchema.validateJsonElement(jsonArrayitems.get(i));
};
// ensure the required json array is present
if (jsonObj.get("required") == null) {
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
} else if (!jsonObj.get("required").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `required` to be an array in the JSON string but got `%s`", jsonObj.get("required").toString()));
}
// ensure the json data is an array
if (!jsonObj.get("allOf").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `allOf` to be an array in the JSON string but got `%s`", jsonObj.get("allOf").toString()));
}
JsonArray jsonArrayallOf = jsonObj.getAsJsonArray("allOf");
// validate the required field `allOf` (array)
for (int i = 0; i < jsonArrayallOf.size(); i++) {
JSchema.validateJsonElement(jsonArrayallOf.get(i));
};
// ensure the json data is an array
if (!jsonObj.get("anyOf").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `anyOf` to be an array in the JSON string but got `%s`", jsonObj.get("anyOf").toString()));
}
JsonArray jsonArrayanyOf = jsonObj.getAsJsonArray("anyOf");
// validate the required field `anyOf` (array)
for (int i = 0; i < jsonArrayanyOf.size(); i++) {
JSchema.validateJsonElement(jsonArrayanyOf.get(i));
};
// ensure the json data is an array
if (!jsonObj.get("oneOf").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `oneOf` to be an array in the JSON string but got `%s`", jsonObj.get("oneOf").toString()));
}
JsonArray jsonArrayoneOf = jsonObj.getAsJsonArray("oneOf");
// validate the required field `oneOf` (array)
for (int i = 0; i < jsonArrayoneOf.size(); i++) {
JSchema.validateJsonElement(jsonArrayoneOf.get(i));
};
// validate the optional field `if`
if (jsonObj.get("if") != null && !jsonObj.get("if").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("if"));
}
// validate the optional field `then`
if (jsonObj.get("then") != null && !jsonObj.get("then").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("then"));
}
// validate the optional field `else`
if (jsonObj.get("else") != null && !jsonObj.get("else").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("else"));
}
// validate the optional field `not`
if (jsonObj.get("not") != null && !jsonObj.get("not").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("not"));
}
// validate the optional field `contains`
if (jsonObj.get("contains") != null && !jsonObj.get("contains").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("contains"));
}
// validate the optional field `propertyNames`
if (jsonObj.get("propertyNames") != null && !jsonObj.get("propertyNames").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("propertyNames"));
}
// ensure the required json array is present
if (jsonObj.get("enum") == null) {
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
} else if (!jsonObj.get("enum").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `enum` to be an array in the JSON string but got `%s`", jsonObj.get("enum").toString()));
}
if ((jsonObj.get("contentEncoding") != null && !jsonObj.get("contentEncoding").isJsonNull()) && !jsonObj.get("contentEncoding").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `contentEncoding` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentEncoding").toString()));
}
if ((jsonObj.get("contentMediaType") != null && !jsonObj.get("contentMediaType").isJsonNull()) && !jsonObj.get("contentMediaType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `contentMediaType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentMediaType").toString()));
}
if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString()));
}
if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
if ((jsonObj.get("pattern") != null && !jsonObj.get("pattern").isJsonNull()) && !jsonObj.get("pattern").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `pattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pattern").toString()));
}
// validate the optional field `additionalProperties`
if (jsonObj.get("additionalProperties") != null && !jsonObj.get("additionalProperties").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("additionalProperties"));
}
// validate the optional field `unevaluatedProperties`
if (jsonObj.get("unevaluatedProperties") != null && !jsonObj.get("unevaluatedProperties").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("unevaluatedProperties"));
}
// validate the optional field `additionalItems`
if (jsonObj.get("additionalItems") != null && !jsonObj.get("additionalItems").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("additionalItems"));
}
// validate the optional field `unevaluatedItems`
if (jsonObj.get("unevaluatedItems") != null && !jsonObj.get("unevaluatedItems").isJsonNull()) {
JSchema.validateJsonElement(jsonObj.get("unevaluatedItems"));
}
if ((jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) && !jsonObj.get("format").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("format").toString()));
}
// ensure the required json array is present
if (jsonObj.get("validators") == null) {
throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`");
} else if (!jsonObj.get("validators").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `validators` to be an array in the JSON string but got `%s`", jsonObj.get("validators").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!JSchema.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'JSchema' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(JSchema.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, JSchema value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public JSchema read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of JSchema given an JSON string
*
* @param jsonString JSON string
* @return An instance of JSchema
* @throws IOException if the JSON string is invalid with respect to JSchema
*/
public static JSchema fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, JSchema.class);
}
/**
* Convert an instance of JSchema to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}