org.openapijsonschematools.client.components.schemas.Pet.java public class Pet
A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema
- classes to store validated list payloads, extends FrozenList
- classes to build inputs for list payloads
- classes to store validated map payloads, extends FrozenMap
- classes to build inputs for map payloads
- enum classes
Modifier and Type | Class and Description |
---|---|
static class | Pet.Pet1 schema class |
static class | Pet.PetMapBuilder builder for Map payloads |
static class | Pet.PetMap output class for Map payloads |
static class | Pet.Tags schema class |
static class | Pet.TagsListBuilder builder for List payloads |
static class | Pet.TagsList output class for List payloads |
static class | Pet.Status schema class |
enum | Pet.StringStatusEnums String enum |
static class | Pet.PhotoUrls schema class |
static class | Pet.PhotoUrlsListBuilder builder for List payloads |
static class | Pet.PhotoUrlsList output class for List payloads |
static class | Pet.Items schema class |
static class | Pet.Name schema class |
static class | Pet.Id schema class |
public static class Pet1
extends JsonSchema
A schema class that validates payloads
Pet object that needs to be added to the store
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
import org.openapijsonschematools.client.exceptions.ValidationException;
import org.openapijsonschematools.client.schemas.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// Map validation
Pet.PetMap validatedPayload =
Pet.Pet1.validate(
new Pet.PetMapBuilder()
.name("a")
.photoUrls(
Arrays.asList(
"a"
)
)
.id(1L)
.category(
MapUtils.makeMap(
new AbstractMap.SimpleEntry<String, Object>(
"name",
"a"
),
new AbstractMap.SimpleEntry<String, Object>(
"id",
1L
)
)
)
.tags(
Arrays.asList(
MapUtils.makeMap(
new AbstractMap.SimpleEntry<>(
"name",
"a"
)
)
)
)
.status("available")
.build(),
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of(Map.class) |
Map<String, Class<? extends JsonSchema>> | properties = Map.ofEntries( new PropertyEntry("id", Id.class)), new PropertyEntry("category", Category.Category1.class), new PropertyEntry("name", Name.class)), new PropertyEntry("photoUrls", PhotoUrls.class)), new PropertyEntry("tags", Tags.class)), new PropertyEntry("status", Status.class)) ) |
Set | required = Set.of( "name", "photoUrls" ) |
Modifier and Type | Method and Description |
---|---|
PetMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class PetMap00Builder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
PetMap00Builder(Map<String, @Nullable Object> instance) Creates a builder that contains the passed instance |
Modifier and Type | Method and Description |
---|---|
Map<String, @Nullable Object> | build() Returns map input that should be used with Schema.validate |
PetMap00Builder | id(int value) |
PetMap00Builder | id(float value) |
PetMap00Builder | id(long value) |
PetMap00Builder | id(double value) |
PetMap00Builder | category(Map<String, @Nullable Object> value) |
PetMap00Builder | tags(List<Map<String, @Nullable Object>> value) |
PetMap00Builder | status(String value) |
PetMap00Builder | status(StringStatusEnums value) |
PetMap00Builder | additionalProperty(String key, Void value) |
PetMap00Builder | additionalProperty(String key, boolean value) |
PetMap00Builder | additionalProperty(String key, String value) |
PetMap00Builder | additionalProperty(String key, int value) |
PetMap00Builder | additionalProperty(String key, float value) |
PetMap00Builder | additionalProperty(String key, long value) |
PetMap00Builder | additionalProperty(String key, double value) |
PetMap00Builder | additionalProperty(String key, List<?> value) |
PetMap00Builder | additionalProperty(String key, Map<String, ?> value) |
public class PetMap01Builder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
PetMap01Builder(Map<String, @Nullable Object> instance) Creates a builder that contains the passed instance |
Modifier and Type | Method and Description |
---|---|
PetMap00Builder | photoUrls(List value) |
public class PetMap10Builder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
PetMap10Builder(Map<String, @Nullable Object> instance) Creates a builder that contains the passed instance |
Modifier and Type | Method and Description |
---|---|
PetMap00Builder | name(String value) |
public class PetMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
PetMapBuilder() Creates a builder that contains an empty map |
Modifier and Type | Method and Description |
---|---|
PetMap01Builder | name(String value) |
PetMap10Builder | photoUrls(List value) |
public static class PetMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static PetMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
String | name() |
PhotoUrlsList | photoUrls() |
Number | id() [optional] value must be a 64 bit integer |
Category.CategoryMap | category() [optional] |
TagsList | tags() [optional] |
String | status() [optional] must be one of ["available", "pending", "sold"] |
@Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public static class Tags
extends JsonSchema
A schema class that validates payloads
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
import org.openapijsonschematools.client.exceptions.ValidationException;
import org.openapijsonschematools.client.schemas.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// List validation
Pet.TagsList validatedPayload =
Pet.Tags.validate(
new Pet.TagsListBuilder()
.add(
MapUtils.makeMap(
new AbstractMap.SimpleEntry<String, Object>(
"id",
1L
),
new AbstractMap.SimpleEntry<String, Object>(
"name",
"a"
)
)
)
.build(),
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of(List.class) |
Class<? extends JsonSchema> | items = Tag.Tag1.class |
Modifier and Type | Method and Description |
---|---|
TagsList | validate(List<?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class TagsListBuilder
builder for List<Map<String, @Nullable Object>>
A class that builds the List input type
Constructor and Description |
---|
TagsListBuilder() Creates an empty list |
TagsListBuilder(List<Map<String, @Nullable Object>> items) Stores the items in a list |
Modifier and Type | Method and Description |
---|---|
TagsListBuilder | add(Map<String, @Nullable Object> item) |
List<Map<String, @Nullable Object>> | build() Returns list input that should be used with Schema.validate |
public class TagsList
extends FrozenList<Tag.TagMap>
A class to store validated List payloads
Modifier and Type | Method and Description |
---|---|
static TagsList | of(List<Map<String, ? extends @Nullable Object>> arg, SchemaConfiguration configuration) |
public static class Status
extends JsonSchema
A schema class that validates payloads
pet status in the store
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
import org.openapijsonschematools.client.exceptions.ValidationException;
import org.openapijsonschematools.client.schemas.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// String validation
String validatedPayload = Pet.Status.validate(
"available",
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of( String.class ) |
Set | enumValues = SetMaker.makeSet( "available", "pending", "sold" ) |
Modifier and Type | Method and Description |
---|---|
String | validate(String arg, SchemaConfiguration configuration) |
String | validate(StringStatusEnums arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public enum StringStatusEnums
extends Enum<StringStatusEnums>
A class that stores String enum values
Enum Constant | Description |
---|---|
AVAILABLE | value = "available" |
PENDING | value = "pending" |
SOLD | value = "sold" |
public static class PhotoUrls
extends JsonSchema
A schema class that validates payloads
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
import org.openapijsonschematools.client.exceptions.ValidationException;
import org.openapijsonschematools.client.schemas.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// List validation
Pet.PhotoUrlsList validatedPayload =
Pet.PhotoUrls.validate(
new Pet.PhotoUrlsListBuilder()
.add("a")
.build(),
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of(List.class) |
Class<? extends JsonSchema> | items = Items.class |
Modifier and Type | Method and Description |
---|---|
PhotoUrlsList | validate(List<?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class PhotoUrlsListBuilder
builder for List<String>
A class that builds the List input type
Constructor and Description |
---|
PhotoUrlsListBuilder() Creates an empty list |
PhotoUrlsListBuilder(List items) Stores the items in a list |
Modifier and Type | Method and Description |
---|---|
PhotoUrlsListBuilder | add(String item) |
List | build() Returns list input that should be used with Schema.validate |
public class PhotoUrlsList
extends FrozenList<String>
A class to store validated List payloads
Modifier and Type | Method and Description |
---|---|
static PhotoUrlsList | of(List arg, SchemaConfiguration configuration) |
public static class Items
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Name
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Id
extends Int64JsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema |
---|
validate |