Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Latest commit

 

History

History
130 lines (108 loc) · 9.4 KB

File metadata and controls

130 lines (108 loc) · 9.4 KB

EnumTest

org.openapijsonschematools.client.components.schemas.EnumTest.java public class EnumTest

A class that contains necessary nested schema classes, and classes to store validated list and map payloads

Nested Class Summary

Modifier and Type Class and Description
static class EnumTest.EnumTest1
schema class
static class EnumTest.EnumTestMap
output class for Map payloads
static class EnumTest.EnumNumber
schema class
static class EnumTest.EnumInteger
schema class
static class EnumTest.EnumStringRequired
schema class
static class EnumTest.EnumString
schema class

EnumTest1

public static class EnumTest1
extends JsonSchema

A schema class that validates payloads

Field Summary

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("enum_string", EnumString.class)),
        new PropertyEntry("enum_string_required", EnumStringRequired.class)),
        new PropertyEntry("enum_integer", EnumInteger.class)),
        new PropertyEntry("enum_number", EnumNumber.class)),
        new PropertyEntry("stringEnum", StringEnum.StringEnum1.class),
        new PropertyEntry("IntegerEnum", IntegerEnum.IntegerEnum1.class),
        new PropertyEntry("StringEnumWithDefaultValue", StringEnumWithDefaultValue.StringEnumWithDefaultValue1.class),
        new PropertyEntry("IntegerEnumWithDefaultValue", IntegerEnumWithDefaultValue.IntegerEnumWithDefaultValue1.class),
        new PropertyEntry("IntegerEnumOneValue", IntegerEnumOneValue.IntegerEnumOneValue1.class)
    ))),
    new KeywordEntry("required", new RequiredValidator(Set.of(
        "enum_string_required"
    )))
));

Method Summary

Modifier and Type Method and Description
static EnumTestMap validate(Map<String, Object> arg, SchemaConfiguration configuration)

EnumTestMap

public static class EnumTestMap
extends FrozenMap<String, Object>

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static EnumTestMap of(Map<String, Object> arg, SchemaConfiguration configuration)
String enum_string_required()
must be one of ["UPPER", "lower", ""]
String enum_string()
[optional] must be one of ["UPPER", "lower", ""]
int enum_integer()
[optional] must be one of [1, -1] value must be a 32 bit integer
double enum_number()
[optional] must be one of [1.1, -1.2] value must be a 64 bit float
String stringEnum()
[optional]
long IntegerEnum()
[optional]
String StringEnumWithDefaultValue()
[optional]
long IntegerEnumWithDefaultValue()
[optional]
long IntegerEnumOneValue()
[optional]
Object getAdditionalProperty(String name)
provides type safety for additional properties

Input Map Keys

type: Map<String, Object>
Key Type Description Notes
enum_string_required String must be one of ["UPPER", "lower", ""]
enum_string String [optional] must be one of ["UPPER", "lower", ""]
enum_integer int [optional] must be one of [1, -1] value must be a 32 bit integer
enum_number double [optional] must be one of [1.1, -1.2] value must be a 64 bit float
stringEnum String [optional]
IntegerEnum long [optional]
StringEnumWithDefaultValue String [optional]
IntegerEnumWithDefaultValue long [optional]
IntegerEnumOneValue long [optional]
anyStringName Object any string name can be used but the value must be the correct type [optional]

EnumNumber

public static class EnumNumber
extends JsonSchema

A schema class that validates payloads

Field Summary

Modifier and Type Field and Description
static LinkedHashMap<String, KeywordValidator> keywordToValidator
new LinkedHashMap<>(Map.ofEntries(
    new KeywordEntry("type", new TypeValidator(Set.of(
        Integer.class,
        Long.class,
        Float.class,
        Double.class
    ))),
    new KeywordEntry("format", new FormatValidator("double")),
    new KeywordEntry("enum", new EnumValidator(Set.of(
        1.1,        -1.2)))
));

Method Summary

Modifier and Type Method and Description
static double validate(double arg, SchemaConfiguration configuration)

EnumInteger

public static class EnumInteger
extends JsonSchema

A schema class that validates payloads

Field Summary

Modifier and Type Field and Description
static LinkedHashMap<String, KeywordValidator> keywordToValidator
new LinkedHashMap<>(Map.ofEntries(
    new KeywordEntry("type", new TypeValidator(Set.of(
        Integer.class,
        Long.class,
        Float.class,
        Double.class
    ))),
    new KeywordEntry("format", new FormatValidator("int32")),
    new KeywordEntry("enum", new EnumValidator(Set.of(
        1,        -1)))
));

Method Summary

Modifier and Type Method and Description
static int validate(int arg, SchemaConfiguration configuration)

EnumStringRequired

public static class EnumStringRequired
extends JsonSchema

A schema class that validates payloads

Field Summary

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(
        "UPPER",
        "lower",
        ""
)))
));

Method Summary

Modifier and Type Method and Description
static String validate(String arg, SchemaConfiguration configuration)

EnumString

public static class EnumString
extends JsonSchema

A schema class that validates payloads

Field Summary

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(
        "UPPER",
        "lower",
        ""
)))
));

Method Summary

Modifier and Type Method and Description
static String validate(String arg, SchemaConfiguration configuration)

[Back to top] [Back to Component Schemas] [Back to README]