org.openapijsonschematools.client.components.schemas.FromSchema.java public class FromSchema
A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema
- classes to store validated map payloads, extends FrozenMap
- classes to build inputs for map payloads
Modifier and Type | Class and Description |
---|---|
static class | FromSchema.FromSchema1 schema class |
static class | FromSchema.FromSchemaMapBuilder builder for Map payloads |
static class | FromSchema.FromSchemaMap output class for Map payloads |
static class | FromSchema.Id schema class |
static class | FromSchema.Data schema class |
public static class FromSchema1
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 java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
// Map validation
FromSchema.FromSchemaMap validatedPayload =
FromSchema.FromSchema1.validate(
new FromSchema.FromSchemaMapBuilder()
.data("a")
.id(1L)
.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("data", Data.class)), new PropertyEntry("id", Id.class)) ) |
Modifier and Type | Method and Description |
---|---|
FromSchemaMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class FromSchemaMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
FromSchemaMapBuilder() 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 |
FromSchemaMapBuilder | data(String value) |
FromSchemaMapBuilder | id(int value) |
FromSchemaMapBuilder | id(float value) |
FromSchemaMapBuilder | id(long value) |
FromSchemaMapBuilder | id(double value) |
FromSchemaMapBuilder | additionalProperty(String key, Void value) |
FromSchemaMapBuilder | additionalProperty(String key, boolean value) |
FromSchemaMapBuilder | additionalProperty(String key, String value) |
FromSchemaMapBuilder | additionalProperty(String key, int value) |
FromSchemaMapBuilder | additionalProperty(String key, float value) |
FromSchemaMapBuilder | additionalProperty(String key, long value) |
FromSchemaMapBuilder | additionalProperty(String key, double value) |
FromSchemaMapBuilder | additionalProperty(String key, List<?> value) |
FromSchemaMapBuilder | additionalProperty(String key, Map<String, ?> value) |
public static class FromSchemaMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static FromSchemaMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
String | data() [optional] |
Number | id() [optional] |
@Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public static class Id
extends IntJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.IntJsonSchema |
---|
validate |
public static class Data
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |