org.openapijsonschematools.client.components.schemas.Whale.java public class Whale
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 | Whale.Whale1 schema class |
| static class | Whale.WhaleMap output class for Map payloads |
| static class | Whale.ClassName schema class |
| static class | Whale.HasTeeth schema class |
| static class | Whale.HasBaleen schema class |
public static class Whale1
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
Whale.WhaleMap validatedPayload =
Whale.Whale1.validate(
MapMaker.makeMap(
new AbstractMap.SimpleEntry<>(
"className",
"whale"
),
new AbstractMap.SimpleEntry<>(
"hasBaleen",
true
),
new AbstractMap.SimpleEntry<>(
"hasTeeth",
true
)
),
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("hasBaleen", HasBaleen.class)), new PropertyEntry("hasTeeth", HasTeeth.class)), new PropertyEntry("className", ClassName.class)) ))), new KeywordEntry("required", new RequiredValidator(Set.of( "className" ))) )); |
| Modifier and Type | Method and Description |
|---|---|
| static WhaleMap | validate(Map<String, Object> arg, SchemaConfiguration configuration) |
public static class WhaleMap
extends FrozenMap<String, Object>
A class to store validated Map payloads
| Modifier and Type | Method and Description |
|---|---|
| static WhaleMap | of(Map<String, Object> arg, SchemaConfiguration configuration) |
| String | className() must be one of ["whale"] |
| boolean | hasBaleen() [optional] |
| boolean | hasTeeth() [optional] |
| Object | getAdditionalProperty(String name) provides type safety for additional properties |
type: Map<String, Object>
| Key | Type | Description | Notes |
|---|---|---|---|
| className | String | must be one of ["whale"] | |
| hasBaleen | boolean | [optional] | |
| hasTeeth | boolean | [optional] | |
| anyStringName | Object | any string name can be used but the value must be the correct type | [optional] |
public static class ClassName
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());
// String validation
String validatedPayload = Whale.ClassName.validate(
"whale",
configuration
);
| Modifier and Type | Field and Description |
|---|---|
| static LinkedHashMap<String, KeywordValidator> | keywordToValidator new LinkedHashMap<>(Map.ofEntries( new KeywordEntry("type", new TypeValidator(Set.of( String.class ))), new KeywordEntry("enum", new EnumValidator(Set.of( "whale" ))) )); |
| Modifier and Type | Method and Description |
|---|---|
| static String | validate(String arg, SchemaConfiguration configuration) |
public static class HasTeeth
extends BooleanJsonSchema
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema |
|---|
| validate |
public static class HasBaleen
extends BooleanJsonSchema
A schema class that validates payloads
| Methods Inherited from class org.openapijsonschematools.client.schemas.BooleanJsonSchema |
|---|
| validate |