org.openapijsonschematools.client.components.schemas.Pet.java public class Pet
A class that contains necessary nested schema classes, and classes to store validated list and map payloads
| Modifier and Type | Class and Description |
|---|---|
| static class | Pet.Pet1 schema class |
| static class | Pet.PetMap output class for Map payloads |
| static class | Pet.Tags schema class |
| static class | Pet.TagsList output class for List payloads |
| static class | Pet.Status schema class |
| static class | Pet.PhotoUrls schema class |
| 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.MapMaker;
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(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"name",
"a"
),
new AbstractMap.SimpleEntry<>(
"photoUrls",
Arrays.asList(
"a"
)
),
new AbstractMap.SimpleEntry<>(
"id",
1L
),
new AbstractMap.SimpleEntry<>(
"category",
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"name",
"a"
),
new AbstractMap.SimpleEntry<>(
"id",
1L
)
)
),
new AbstractMap.SimpleEntry<>(
"tags",
Arrays.asList(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"name",
"a"
)
)
)
),
new AbstractMap.SimpleEntry<>(
"status",
"available"
)
),
configuration
);
| Modifier and Type | Field and Description |
|---|---|
| static LinkedHashMap<String, KeywordValidator> | keywordToValidator new LinkedHashMap<>(Map.ofEntries( new KeywordEntry("type", new TypeValidator(Set.of(FrozenMap.class))), new KeywordEntry("properties", new PropertiesValidator(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)) ))), new KeywordEntry("required", new RequiredValidator(Set.of( "name", "photoUrls" ))) )); |
| Modifier and Type | Method and Description |
|---|---|
| static PetMap | validate(Map<String, Object> arg, SchemaConfiguration configuration) |
public static class PetMap
extends FrozenMap<String, Object>
A class to store validated Map payloads
| Modifier and Type | Method and Description |
|---|---|
| static PetMap | of(Map<String, Object> arg, SchemaConfiguration configuration) |
| String | name() |
| PhotoUrlsList | photoUrls() |
| long | 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"] |
| Object | getAdditionalProperty(String name) provides type safety for additional properties |
type: Map<String, Object>
| Key | Type | Description | Notes |
|---|---|---|---|
| name | String | ||
| photoUrls | List | ||
| id | long | [optional] value must be a 64 bit integer | |
| category | Map<String, Object> | [optional] | |
| tags | List<Map<String, Object>> | [optional] | |
| status | String | pet status in the store | [optional] must be one of ["available", "pending", "sold"] |
| anyStringName | Object | any string name can be used but the value must be the correct type | [optional] |
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.MapMaker;
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(
Arrays.asList(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"id",
1L
),
new AbstractMap.SimpleEntry<>(
"name",
"a"
)
)
),
configuration
);
| Modifier and Type | Field and Description |
|---|---|
| static LinkedHashMap<String, KeywordValidator> | keywordToValidator new LinkedHashMap<>(Map.ofEntries( new KeywordEntry("type", new TypeValidator(Set.of(FrozenList.class))), new KeywordEntry("items", new ItemsValidator(Tag.Tag1.class) )); |
| Modifier and Type | Method and Description |
|---|---|
| static TagsList | validate(List<Map<String, Object>> arg, SchemaConfiguration configuration) |
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, Object>> arg, SchemaConfiguration configuration) |
type: List<Map<String, Object>>
| List Item Type | Description | Notes |
|---|---|---|
| Map<String, Object> |
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.MapMaker;
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 |
|---|---|
| static LinkedHashMap<String, KeywordValidator> | keywordToValidator new LinkedHashMap<>(Map.ofEntries( new KeywordEntry("type", new TypeValidator(Set.of( String.class ))), new KeywordEntry("enum", new EnumValidator(Set.of( "available", "pending", "sold" ))) )); |
| Modifier and Type | Method and Description |
|---|---|
| static String | validate(String arg, SchemaConfiguration configuration) |
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.MapMaker;
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(
Arrays.asList(
"a"
),
configuration
);
| Modifier and Type | Field and Description |
|---|---|
| static LinkedHashMap<String, KeywordValidator> | keywordToValidator new LinkedHashMap<>(Map.ofEntries( new KeywordEntry("type", new TypeValidator(Set.of(FrozenList.class))), new KeywordEntry("items", new ItemsValidator(Items.class)) )); |
| Modifier and Type | Method and Description |
|---|---|
| static PhotoUrlsList | validate(List arg, SchemaConfiguration configuration) |
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) |
type: List<String>
| List Item Type | Description | Notes |
|---|---|---|
| String |
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 |