org.openapijsonschematools.client.components.schemas.Drawing.java
public class Drawing
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 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
Modifier and Type | Class and Description |
---|---|
sealed interface | Drawing.Drawing1Boxed sealed interface for validated payloads |
record | Drawing.Drawing1BoxedMap boxed class to store validated Map payloads |
static class | Drawing.Drawing1 schema class |
static class | Drawing.DrawingMapBuilder builder for Map payloads |
static class | Drawing.DrawingMap output class for Map payloads |
sealed interface | Drawing.ShapesBoxed sealed interface for validated payloads |
record | Drawing.ShapesBoxedList boxed class to store validated List payloads |
static class | Drawing.Shapes schema class |
static class | Drawing.ShapesListBuilder builder for List payloads |
static class | Drawing.ShapesList output class for List payloads |
public sealed interface Drawing1Boxed
permits
Drawing1BoxedMap
sealed interface that stores validated payloads using boxed classes
public record Drawing1BoxedMap
implements Drawing1Boxed
record that stores validated Map payloads, sealed permits implementation
Constructor and Description |
---|
Drawing1BoxedMap(DrawingMap data) Creates an instance, private visibility |
Modifier and Type | Method and Description |
---|---|
DrawingMap | data() validated payload |
@Nullable Object | getData() validated payload |
public static class Drawing1
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.Drawing;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// Map validation
Drawing.DrawingMap validatedPayload =
Drawing.Drawing1.validate(
new Drawing.DrawingMapBuilder()
.shapes(
Arrays.asList(
)
)
.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("mainShape", Shape.Shape1.class), new PropertyEntry("shapeOrNull", ShapeOrNull.ShapeOrNull1.class), new PropertyEntry("nullableShape", NullableShape.NullableShape1.class), new PropertyEntry("shapes", Shapes.class)) ) |
Class<? extends JsonSchema> | additionalProperties = Fruit.Fruit1.class |
Modifier and Type | Method and Description |
---|---|
DrawingMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
Drawing1BoxedMap | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) |
Drawing1Boxed | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class DrawingMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
DrawingMapBuilder() 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 |
DrawingMapBuilder | mainShape(Void value) |
DrawingMapBuilder | mainShape(boolean value) |
DrawingMapBuilder | mainShape(String value) |
DrawingMapBuilder | mainShape(int value) |
DrawingMapBuilder | mainShape(float value) |
DrawingMapBuilder | mainShape(long value) |
DrawingMapBuilder | mainShape(double value) |
DrawingMapBuilder | mainShape(List<?> value) |
DrawingMapBuilder | mainShape(Map<String, ?> value) |
DrawingMapBuilder | shapeOrNull(Void value) |
DrawingMapBuilder | shapeOrNull(boolean value) |
DrawingMapBuilder | shapeOrNull(String value) |
DrawingMapBuilder | shapeOrNull(int value) |
DrawingMapBuilder | shapeOrNull(float value) |
DrawingMapBuilder | shapeOrNull(long value) |
DrawingMapBuilder | shapeOrNull(double value) |
DrawingMapBuilder | shapeOrNull(List<?> value) |
DrawingMapBuilder | shapeOrNull(Map<String, ?> value) |
DrawingMapBuilder | nullableShape(Void value) |
DrawingMapBuilder | nullableShape(boolean value) |
DrawingMapBuilder | nullableShape(String value) |
DrawingMapBuilder | nullableShape(int value) |
DrawingMapBuilder | nullableShape(float value) |
DrawingMapBuilder | nullableShape(long value) |
DrawingMapBuilder | nullableShape(double value) |
DrawingMapBuilder | nullableShape(List<?> value) |
DrawingMapBuilder | nullableShape(Map<String, ?> value) |
DrawingMapBuilder | shapes(List<@Nullable Object> value) |
DrawingMapBuilder | additionalProperty(String key, Void value) |
DrawingMapBuilder | additionalProperty(String key, boolean value) |
DrawingMapBuilder | additionalProperty(String key, String value) |
DrawingMapBuilder | additionalProperty(String key, int value) |
DrawingMapBuilder | additionalProperty(String key, float value) |
DrawingMapBuilder | additionalProperty(String key, long value) |
DrawingMapBuilder | additionalProperty(String key, double value) |
DrawingMapBuilder | additionalProperty(String key, List<?> value) |
DrawingMapBuilder | additionalProperty(String key, Map<String, ?> value) |
public static class DrawingMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static DrawingMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
@Nullable Object | mainShape() [optional] |
@Nullable Object | shapeOrNull() [optional] |
@Nullable Object | nullableShape() [optional] |
ShapesList | shapes() [optional] |
@Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public sealed interface ShapesBoxed
permits
ShapesBoxedList
sealed interface that stores validated payloads using boxed classes
public record ShapesBoxedList
implements ShapesBoxed
record that stores validated List payloads, sealed permits implementation
Constructor and Description |
---|
ShapesBoxedList(ShapesList data) Creates an instance, private visibility |
Modifier and Type | Method and Description |
---|---|
ShapesList | data() validated payload |
@Nullable Object | getData() validated payload |
public static class Shapes
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.Drawing;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// List validation
Drawing.ShapesList validatedPayload =
Drawing.Shapes.validate(
new Drawing.ShapesListBuilder()
.build(),
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of(List.class) |
Class<? extends JsonSchema> | items = Shape.Shape1.class |
Modifier and Type | Method and Description |
---|---|
ShapesList | validate(List<?> arg, SchemaConfiguration configuration) |
ShapesBoxedList | validateAndBox(List<?> arg, SchemaConfiguration configuration) |
ShapesBoxed | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class ShapesListBuilder
builder for List<@Nullable Object>
A class that builds the List input type
Constructor and Description |
---|
ShapesListBuilder() Creates an empty list |
ShapesListBuilder(List<@Nullable Object> items) Stores the items in a list |
Modifier and Type | Method and Description |
---|---|
ShapesListBuilder | add(Void item) |
ShapesListBuilder | add(boolean item) |
ShapesListBuilder | add(String item) |
ShapesListBuilder | add(int item) |
ShapesListBuilder | add(float item) |
ShapesListBuilder | add(long item) |
ShapesListBuilder | add(double item) |
ShapesListBuilder | add(List<?> item) |
ShapesListBuilder | add(Map<String, ?> item) |
List<@Nullable Object> | build() Returns list input that should be used with Schema.validate |
public class ShapesList
extends FrozenList<@Nullable Object>
A class to store validated List payloads
Modifier and Type | Method and Description |
---|---|
static ShapesList | of(List<? extends @Nullable Object> arg, SchemaConfiguration configuration) |