org.openapijsonschematools.client.components.schemas.Order.java
public class Order
A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema
- sealed interfaces which store validated payloads, java version of a sum type
- boxed classes which store validated payloads, sealed permits class implementations
- classes to store validated map payloads, extends FrozenMap
- classes to build inputs for map payloads
- enum classes
| Modifier and Type | Class and Description |
|---|---|
| sealed interface | Order.Order1Boxed sealed interface for validated payloads |
| record | Order.Order1BoxedMap boxed class to store validated Map payloads |
| static class | Order.Order1 schema class |
| static class | Order.OrderMapBuilder builder for Map payloads |
| static class | Order.OrderMap output class for Map payloads |
| sealed interface | Order.CompleteBoxed sealed interface for validated payloads |
| record | Order.CompleteBoxedBoolean boxed class to store validated boolean payloads |
| static class | Order.Complete schema class |
| sealed interface | Order.StatusBoxed sealed interface for validated payloads |
| record | Order.StatusBoxedString boxed class to store validated String payloads |
| static class | Order.Status schema class |
| enum | Order.StringStatusEnums String enum |
| sealed interface | Order.ShipDateBoxed sealed interface for validated payloads |
| record | Order.ShipDateBoxedString boxed class to store validated String payloads |
| static class | Order.ShipDate schema class |
| sealed interface | Order.QuantityBoxed sealed interface for validated payloads |
| record | Order.QuantityBoxedNumber boxed class to store validated Number payloads |
| static class | Order.Quantity schema class |
| sealed interface | Order.PetIdBoxed sealed interface for validated payloads |
| record | Order.PetIdBoxedNumber boxed class to store validated Number payloads |
| static class | Order.PetId schema class |
| sealed interface | Order.IdBoxed sealed interface for validated payloads |
| record | Order.IdBoxedNumber boxed class to store validated Number payloads |
| static class | Order.Id schema class |
public sealed interface Order1Boxed
permits
Order1BoxedMap
sealed interface that stores validated payloads using boxed classes
public record Order1BoxedMap
implements Order1Boxed
record that stores validated Map payloads, sealed permits implementation
| Constructor and Description |
|---|
| Order1BoxedMap(OrderMap data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| OrderMap | data() validated payload |
| @Nullable Object | getData() validated payload |
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.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import org.openapijsonschematools.client.components.schemas.Order;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());
// Map validation
Order.OrderMap validatedPayload =
Order.Order1.validate(
new Order.OrderMapBuilder()
.id(1L)
.petId(1L)
.quantity(1)
.shipDate("1970-01-01T00:00:00.00Z")
.status("placed")
.complete(true)
.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("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 |
|---|---|
| OrderMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
| Order1BoxedMap | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) |
| Order1Boxed | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) |
| @Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class OrderMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
| Constructor and Description |
|---|
| OrderMapBuilder() Creates a builder that contains an empty map |
| Modifier and Type | Method and Description |
|---|---|
| Map<String, @Nullable Object> | build() Returns map input that should be used with Schema.validate |
| OrderMapBuilder | id(int value) |
| OrderMapBuilder | id(float value) |
| OrderMapBuilder | id(long value) |
| OrderMapBuilder | id(double value) |
| OrderMapBuilder | petId(int value) |
| OrderMapBuilder | petId(float value) |
| OrderMapBuilder | petId(long value) |
| OrderMapBuilder | petId(double value) |
| OrderMapBuilder | quantity(int value) |
| OrderMapBuilder | quantity(float value) |
| OrderMapBuilder | shipDate(String value) |
| OrderMapBuilder | status(String value) |
| OrderMapBuilder | status(StringStatusEnums value) |
| OrderMapBuilder | complete(boolean value) |
| OrderMapBuilder | additionalProperty(String key, Void value) |
| OrderMapBuilder | additionalProperty(String key, boolean value) |
| OrderMapBuilder | additionalProperty(String key, String value) |
| OrderMapBuilder | additionalProperty(String key, int value) |
| OrderMapBuilder | additionalProperty(String key, float value) |
| OrderMapBuilder | additionalProperty(String key, long value) |
| OrderMapBuilder | additionalProperty(String key, double value) |
| OrderMapBuilder | additionalProperty(String key, List<?> value) |
| OrderMapBuilder | additionalProperty(String key, Map<String, ?> value) |
public static class OrderMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
| Modifier and Type | Method and Description |
|---|---|
| static OrderMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
| Number | id() [optional] value must be a 64 bit integer |
| Number | petId() [optional] value must be a 64 bit integer |
| Number | 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 |
| @Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public sealed interface CompleteBoxed
permits
CompleteBoxedBoolean
sealed interface that stores validated payloads using boxed classes
public record CompleteBoxedBoolean
implements CompleteBoxed
record that stores validated boolean payloads, sealed permits implementation
| Constructor and Description |
|---|
| CompleteBoxedBoolean(boolean data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| boolean | data() validated payload |
| @Nullable Object | getData() validated payload |
public static class Complete
extends BooleanJsonSchema.BooleanJsonSchema1
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema.BooleanJsonSchema1 |
|---|
| validate |
| validateAndBox |
public sealed interface StatusBoxed
permits
StatusBoxedString
sealed interface that stores validated payloads using boxed classes
public record StatusBoxedString
implements StatusBoxed
record that stores validated String payloads, sealed permits implementation
| Constructor and Description |
|---|
| StatusBoxedString(String data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| String | data() validated payload |
| @Nullable Object | getData() validated payload |
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.validation.MapUtils;
import org.openapijsonschematools.client.schemas.validation.FrozenList;
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
import org.openapijsonschematools.client.components.schemas.Order;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());
// String validation
String validatedPayload = Order.Status.validate(
"placed",
configuration
);
| Modifier and Type | Field and Description |
|---|---|
| Set<Class<?>> | type = Set.of( String.class ) |
| Set | enumValues = SetMaker.makeSet( "placed", "approved", "delivered" ) |
| Modifier and Type | Method and Description |
|---|---|
| String | validate(String arg, SchemaConfiguration configuration) |
| String | validate(StringStatusEnums arg, SchemaConfiguration configuration) |
| StatusBoxedString | validateAndBox(String arg, SchemaConfiguration configuration) |
| StatusBoxed | validateAndBox(@Nullable Object 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 |
|---|---|
| PLACED | value = "placed" |
| APPROVED | value = "approved" |
| DELIVERED | value = "delivered" |
public sealed interface ShipDateBoxed
permits
ShipDateBoxedString
sealed interface that stores validated payloads using boxed classes
public record ShipDateBoxedString
implements ShipDateBoxed
record that stores validated String payloads, sealed permits implementation
| Constructor and Description |
|---|
| ShipDateBoxedString(String data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| String | data() validated payload |
| @Nullable Object | getData() validated payload |
public static class ShipDate
extends DateTimeJsonSchema.DateTimeJsonSchema1
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.DateTimeJsonSchema.DateTimeJsonSchema1 |
|---|
| validate |
| validateAndBox |
public sealed interface QuantityBoxed
permits
QuantityBoxedNumber
sealed interface that stores validated payloads using boxed classes
public record QuantityBoxedNumber
implements QuantityBoxed
record that stores validated Number payloads, sealed permits implementation
| Constructor and Description |
|---|
| QuantityBoxedNumber(Number data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| Number | data() validated payload |
| @Nullable Object | getData() validated payload |
public static class Quantity
extends Int32JsonSchema.Int32JsonSchema1
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema.Int32JsonSchema1 |
|---|
| validate |
| validateAndBox |
public sealed interface PetIdBoxed
permits
PetIdBoxedNumber
sealed interface that stores validated payloads using boxed classes
public record PetIdBoxedNumber
implements PetIdBoxed
record that stores validated Number payloads, sealed permits implementation
| Constructor and Description |
|---|
| PetIdBoxedNumber(Number data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| Number | data() validated payload |
| @Nullable Object | getData() validated payload |
public static class PetId
extends Int64JsonSchema.Int64JsonSchema1
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 |
|---|
| validate |
| validateAndBox |
public sealed interface IdBoxed
permits
IdBoxedNumber
sealed interface that stores validated payloads using boxed classes
public record IdBoxedNumber
implements IdBoxed
record that stores validated Number payloads, sealed permits implementation
| Constructor and Description |
|---|
| IdBoxedNumber(Number data) Creates an instance, private visibility |
| Modifier and Type | Method and Description |
|---|---|
| Number | data() validated payload |
| @Nullable Object | getData() validated payload |
public static class Id
extends Int64JsonSchema.Int64JsonSchema1
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1 |
|---|
| validate |
| validateAndBox |