org.openapijsonschematools.client.components.schemas.ObjectWithDecimalProperties.java public class ObjectWithDecimalProperties
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 | ObjectWithDecimalProperties.ObjectWithDecimalProperties1 schema class |
static class | ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap output class for Map payloads |
static class | ObjectWithDecimalProperties.Width schema class |
public static class ObjectWithDecimalProperties1
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
ObjectWithDecimalProperties.ObjectWithDecimalPropertiesMap validatedPayload =
ObjectWithDecimalProperties.ObjectWithDecimalProperties1.validate(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"length",
"3.14"
),
new AbstractMap.SimpleEntry<>(
"width",
"3.14"
),
new AbstractMap.SimpleEntry<>(
"cost",
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"amount",
"3.14"
),
new AbstractMap.SimpleEntry<>(
"currency",
"eur"
)
)
)
),
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("length", DecimalPayload.DecimalPayload1.class), new PropertyEntry("width", Width.class)), new PropertyEntry("cost", Money.Money1.class) ))) )); |
Modifier and Type | Method and Description |
---|---|
static ObjectWithDecimalPropertiesMap | validate(Map<String, Object> arg, SchemaConfiguration configuration) |
public static class ObjectWithDecimalPropertiesMap
extends FrozenMap<String, Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static ObjectWithDecimalPropertiesMap | of(Map<String, Object> arg, SchemaConfiguration configuration) |
String | length() [optional] |
String | width() [optional] value must be int or float numeric |
Money.MoneyMap | cost() [optional] |
Object | getAdditionalProperty(String name) provides type safety for additional properties |
type: Map<String, Object>
Key | Type | Description | Notes |
---|---|---|---|
length | String | [optional] | |
width | String | [optional] value must be int or float numeric | |
cost | Map<String, Object> | [optional] | |
anyStringName | Object | any string name can be used but the value must be the correct type | [optional] |
public static class Width
extends DecimalJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.DecimalJsonSchema |
---|
validate |