org.openapijsonschematools.client.components.schemas.Banana.java
public class Banana
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
Modifier and Type | Class and Description |
---|---|
sealed interface | Banana.Banana1Boxed sealed interface for validated payloads |
record | Banana.Banana1BoxedMap boxed class to store validated Map payloads |
static class | Banana.Banana1 schema class |
static class | Banana.BananaMapBuilder builder for Map payloads |
static class | Banana.BananaMap output class for Map payloads |
sealed interface | Banana.LengthCmBoxed sealed interface for validated payloads |
record | Banana.LengthCmBoxedNumber boxed class to store validated Number payloads |
static class | Banana.LengthCm schema class |
public sealed interface Banana1Boxed
permits
Banana1BoxedMap
sealed interface that stores validated payloads using boxed classes
public record Banana1BoxedMap
implements Banana1Boxed
record that stores validated Map payloads, sealed permits implementation
Constructor and Description |
---|
Banana1BoxedMap(BananaMap data) Creates an instance, private visibility |
Modifier and Type | Method and Description |
---|---|
BananaMap | data() validated payload |
@Nullable Object | getData() validated payload |
public static class Banana1
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.Banana;
import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());
// Map validation
Banana.BananaMap validatedPayload =
Banana.Banana1.validate(
new Banana.BananaMapBuilder()
.lengthCm(1)
.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("lengthCm", LengthCm.class)) ) |
Set | required = Set.of( "lengthCm" ) |
Modifier and Type | Method and Description |
---|---|
BananaMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
Banana1BoxedMap | validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration) |
Banana1Boxed | validateAndBox(@Nullable Object arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class BananaMap0Builder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
BananaMap0Builder(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 |
BananaMap0Builder | additionalProperty(String key, Void value) |
BananaMap0Builder | additionalProperty(String key, boolean value) |
BananaMap0Builder | additionalProperty(String key, String value) |
BananaMap0Builder | additionalProperty(String key, int value) |
BananaMap0Builder | additionalProperty(String key, float value) |
BananaMap0Builder | additionalProperty(String key, long value) |
BananaMap0Builder | additionalProperty(String key, double value) |
BananaMap0Builder | additionalProperty(String key, List<?> value) |
BananaMap0Builder | additionalProperty(String key, Map<String, ?> value) |
public class BananaMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
BananaMapBuilder() Creates a builder that contains an empty map |
Modifier and Type | Method and Description |
---|---|
BananaMap0Builder | lengthCm(int value) |
BananaMap0Builder | lengthCm(float value) |
BananaMap0Builder | lengthCm(long value) |
BananaMap0Builder | lengthCm(double value) |
public static class BananaMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static BananaMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
Number | lengthCm() |
@Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public sealed interface LengthCmBoxed
permits
LengthCmBoxedNumber
sealed interface that stores validated payloads using boxed classes
public record LengthCmBoxedNumber
implements LengthCmBoxed
record that stores validated Number payloads, sealed permits implementation
Constructor and Description |
---|
LengthCmBoxedNumber(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 LengthCm
extends NumberJsonSchema.NumberJsonSchema1
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1 |
---|
validate |
validateAndBox |