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

Latest commit

 

History

History
416 lines (335 loc) · 17 KB

File metadata and controls

416 lines (335 loc) · 17 KB

EnumArrays

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

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 list payloads, extends FrozenList
  • classes to build inputs for list payloads
  • classes to store validated map payloads, extends FrozenMap
  • classes to build inputs for map payloads
  • enum classes

Nested Class Summary

Modifier and Type Class and Description
sealed interface EnumArrays.EnumArrays1Boxed
sealed interface for validated payloads
record EnumArrays.EnumArrays1BoxedMap
boxed class to store validated Map payloads
static class EnumArrays.EnumArrays1
schema class
static class EnumArrays.EnumArraysMapBuilder
builder for Map payloads
static class EnumArrays.EnumArraysMap
output class for Map payloads
sealed interface EnumArrays.ArrayEnumBoxed
sealed interface for validated payloads
record EnumArrays.ArrayEnumBoxedList
boxed class to store validated List payloads
static class EnumArrays.ArrayEnum
schema class
static class EnumArrays.ArrayEnumListBuilder
builder for List payloads
static class EnumArrays.ArrayEnumList
output class for List payloads
sealed interface EnumArrays.ItemsBoxed
sealed interface for validated payloads
record EnumArrays.ItemsBoxedString
boxed class to store validated String payloads
static class EnumArrays.Items
schema class
enum EnumArrays.StringItemsEnums
String enum
sealed interface EnumArrays.JustSymbolBoxed
sealed interface for validated payloads
record EnumArrays.JustSymbolBoxedString
boxed class to store validated String payloads
static class EnumArrays.JustSymbol
schema class
enum EnumArrays.StringJustSymbolEnums
String enum

EnumArrays1Boxed

public sealed interface EnumArrays1Boxed
permits
EnumArrays1BoxedMap

sealed interface that stores validated payloads using boxed classes

EnumArrays1BoxedMap

public record EnumArrays1BoxedMap
implements EnumArrays1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
EnumArrays1BoxedMap(EnumArraysMap data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
EnumArraysMap data()
validated payload
@Nullable Object getData()
validated payload

EnumArrays1

public static class EnumArrays1
extends JsonSchema

A schema class that validates payloads

Code Sample

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.EnumArrays;

import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// Map validation
EnumArrays.EnumArraysMap validatedPayload =
    EnumArrays.EnumArrays1.validate(
    new EnumArrays.EnumArraysMapBuilder()
        .just_symbol(">=")

        .array_enum(
            Arrays.asList(
                "fish"
            )
        )
    .build(),
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(Map.class)
Map<String, Class<? extends JsonSchema>> properties = Map.ofEntries(
    new PropertyEntry("just_symbol", JustSymbol.class)),
    new PropertyEntry("array_enum", ArrayEnum.class))
)

Method Summary

Modifier and Type Method and Description
EnumArraysMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
EnumArrays1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
EnumArrays1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

EnumArraysMapBuilder

public class EnumArraysMapBuilder
builder for Map<String, @Nullable Object>

A class that builds the Map input type

Constructor Summary

Constructor and Description
EnumArraysMapBuilder()
Creates a builder that contains an empty map

Method Summary

Modifier and Type Method and Description
Map<String, @Nullable Object> build()
Returns map input that should be used with Schema.validate
EnumArraysMapBuilder just_symbol(String value)
EnumArraysMapBuilder just_symbol(StringJustSymbolEnums value)
EnumArraysMapBuilder array_enum(List value)
EnumArraysMapBuilder additionalProperty(String key, Void value)
EnumArraysMapBuilder additionalProperty(String key, boolean value)
EnumArraysMapBuilder additionalProperty(String key, String value)
EnumArraysMapBuilder additionalProperty(String key, int value)
EnumArraysMapBuilder additionalProperty(String key, float value)
EnumArraysMapBuilder additionalProperty(String key, long value)
EnumArraysMapBuilder additionalProperty(String key, double value)
EnumArraysMapBuilder additionalProperty(String key, List<?> value)
EnumArraysMapBuilder additionalProperty(String key, Map<String, ?> value)

EnumArraysMap

public static class EnumArraysMap
extends FrozenMap<String, @Nullable Object>

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static EnumArraysMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
String just_symbol()
[optional] must be one of [">=", "$"]
ArrayEnumList array_enum()
[optional]
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

ArrayEnumBoxed

public sealed interface ArrayEnumBoxed
permits
ArrayEnumBoxedList

sealed interface that stores validated payloads using boxed classes

ArrayEnumBoxedList

public record ArrayEnumBoxedList
implements ArrayEnumBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ArrayEnumBoxedList(ArrayEnumList data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
ArrayEnumList data()
validated payload
@Nullable Object getData()
validated payload

ArrayEnum

public static class ArrayEnum
extends JsonSchema

A schema class that validates payloads

Code Sample

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.EnumArrays;

import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// List validation
EnumArrays.ArrayEnumList validatedPayload =
    EnumArrays.ArrayEnum.validate(
    new EnumArrays.ArrayEnumListBuilder()
        .add("fish")

    .build(),
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(List.class)
Class<? extends JsonSchema> items = Items.class

Method Summary

Modifier and Type Method and Description
ArrayEnumList validate(List<?> arg, SchemaConfiguration configuration)
ArrayEnumBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
ArrayEnumBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

ArrayEnumListBuilder

public class ArrayEnumListBuilder
builder for List<String>

A class that builds the List input type

Constructor Summary

Constructor and Description
ArrayEnumListBuilder()
Creates an empty list
ArrayEnumListBuilder(List items)
Stores the items in a list

Method Summary

Modifier and Type Method and Description
ArrayEnumListBuilder add(String item)
ArrayEnumListBuilder add(StringItemsEnums item)
List build()
Returns list input that should be used with Schema.validate

ArrayEnumList

public class ArrayEnumList
extends FrozenList<String>

A class to store validated List payloads

Method Summary

Modifier and Type Method and Description
static ArrayEnumList of(List arg, SchemaConfiguration configuration)

ItemsBoxed

public sealed interface ItemsBoxed
permits
ItemsBoxedString

sealed interface that stores validated payloads using boxed classes

ItemsBoxedString

public record ItemsBoxedString
implements ItemsBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedString(String data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
String data()
validated payload
@Nullable Object getData()
validated payload

Items

public static class Items
extends JsonSchema

A schema class that validates payloads

Code Sample

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.EnumArrays;

import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// String validation
String validatedPayload = EnumArrays.Items.validate(
    "fish",
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    String.class
)
Set enumValues = SetMaker.makeSet(
    "fish",
    "crab"
)

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
String validate(StringItemsEnums arg, SchemaConfiguration configuration)
ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

StringItemsEnums

public enum StringItemsEnums
extends Enum<StringItemsEnums>

A class that stores String enum values

Enum Constant Summary

Enum Constant Description
FISH value = "fish"
CRAB value = "crab"

JustSymbolBoxed

public sealed interface JustSymbolBoxed
permits
JustSymbolBoxedString

sealed interface that stores validated payloads using boxed classes

JustSymbolBoxedString

public record JustSymbolBoxedString
implements JustSymbolBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

Constructor and Description
JustSymbolBoxedString(String data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
String data()
validated payload
@Nullable Object getData()
validated payload

JustSymbol

public static class JustSymbol
extends JsonSchema

A schema class that validates payloads

Code Sample

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.EnumArrays;

import java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// String validation
String validatedPayload = EnumArrays.JustSymbol.validate(
    ">=",
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    String.class
)
Set enumValues = SetMaker.makeSet(
    ">=",
    "$"
)

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
String validate(StringJustSymbolEnums arg, SchemaConfiguration configuration)
JustSymbolBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
JustSymbolBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

StringJustSymbolEnums

public enum StringJustSymbolEnums
extends Enum<StringJustSymbolEnums>

A class that stores String enum values

Enum Constant Summary

Enum Constant Description
GREATER_THAN_SIGN_EQUALS_SIGN value = ">="
DOLLAR_SIGN value = "$"

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