org.openapijsonschematools.client.components.schemas.Order.java public class Order
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 | Order.Order1 schema class |
static class | Order.OrderMap output class for Map payloads |
static class | Order.Complete schema class |
static class | Order.Status schema class |
static class | Order.ShipDate schema class |
static class | Order.Quantity schema class |
static class | Order.PetId schema class |
static class | Order.Id schema class |
public static class Order1
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());
// Map validation
Order.OrderMap validatedPayload =
Order.Order1.validate(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"id",
1L
),
new AbstractMap.SimpleEntry<>(
"petId",
1L
),
new AbstractMap.SimpleEntry<>(
"quantity",
1
),
new AbstractMap.SimpleEntry<>(
"shipDate",
"1970-01-01T00:00:00.00Z"
),
new AbstractMap.SimpleEntry<>(
"status",
"placed"
),
new AbstractMap.SimpleEntry<>(
"complete",
true
)
),
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("petId", PetId.class)), new PropertyEntry("quantity", Quantity.class)), new PropertyEntry("shipDate", ShipDate.class)), new PropertyEntry("status", Status.class)), new PropertyEntry("complete", Complete.class)) ))) )); |
Modifier and Type | Method and Description |
---|---|
static OrderMap | validate(Map<String, Object> arg, SchemaConfiguration configuration) |
public static class OrderMap
extends FrozenMap<String, Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static OrderMap | of(Map<String, Object> arg, SchemaConfiguration configuration) |
long | id() [optional] value must be a 64 bit integer |
long | petId() [optional] value must be a 64 bit integer |
int | quantity() [optional] value must be a 32 bit integer |
String | shipDate() [optional] value must conform to RFC-3339 date-time |
String | status() [optional] must be one of ["placed", "approved", "delivered"] |
boolean | complete() [optional] if omitted the server will use the default value of false |
Object | getAdditionalProperty(String name) provides type safety for additional properties |
type: Map<String, Object>
Key | Type | Description | Notes |
---|---|---|---|
id | long | [optional] value must be a 64 bit integer | |
petId | long | [optional] value must be a 64 bit integer | |
quantity | int | [optional] value must be a 32 bit integer | |
shipDate | String | [optional] value must conform to RFC-3339 date-time | |
status | String | Order Status | [optional] must be one of ["placed", "approved", "delivered"] |
complete | boolean | [optional] if omitted the server will use the default value of false | |
anyStringName | Object | any string name can be used but the value must be the correct type | [optional] |
public static class Complete
extends BooleanJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema |
---|
validate |
public static class Status
extends JsonSchema
A schema class that validates payloads
Order Status
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 = Order.Status.validate(
"placed",
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( "placed", "approved", "delivered" ))) )); |
Modifier and Type | Method and Description |
---|---|
static String | validate(String arg, SchemaConfiguration configuration) |
public static class ShipDate
extends DateTimeJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema |
---|
validate |
public static class Quantity
extends Int32JsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema |
---|
validate |
public static class PetId
extends Int64JsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema |
---|
validate |
public static class Id
extends Int64JsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema |
---|
validate |