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

Latest commit

 

History

History
260 lines (207 loc) · 10.2 KB

File metadata and controls

260 lines (207 loc) · 10.2 KB

ComposedArray

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

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

Nested Class Summary

Modifier and Type Class and Description
sealed interface ComposedArray.ComposedArray1Boxed
sealed interface for validated payloads
record ComposedArray.ComposedArray1BoxedList
boxed class to store validated List payloads
static class ComposedArray.ComposedArray1
schema class
static class ComposedArray.ComposedArrayListBuilder
builder for List payloads
static class ComposedArray.ComposedArrayList
output class for List payloads
sealed interface ComposedArray.ItemsBoxed
sealed interface for validated payloads
record ComposedArray.ItemsBoxedVoid
boxed class to store validated null payloads
record ComposedArray.ItemsBoxedBoolean
boxed class to store validated boolean payloads
record ComposedArray.ItemsBoxedNumber
boxed class to store validated Number payloads
record ComposedArray.ItemsBoxedString
boxed class to store validated String payloads
record ComposedArray.ItemsBoxedList
boxed class to store validated List payloads
record ComposedArray.ItemsBoxedMap
boxed class to store validated Map payloads
static class ComposedArray.Items
schema class

ComposedArray1Boxed

public sealed interface ComposedArray1Boxed
permits
ComposedArray1BoxedList

sealed interface that stores validated payloads using boxed classes

ComposedArray1BoxedList

public record ComposedArray1BoxedList
implements ComposedArray1Boxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ComposedArray1BoxedList(ComposedArrayList data)
Creates an instance, private visibility

Method Summary

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

ComposedArray1

public static class ComposedArray1
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.ComposedArray;

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

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

// List validation
ComposedArray.ComposedArrayList validatedPayload =
    ComposedArray.ComposedArray1.validate(
    new ComposedArray.ComposedArrayListBuilder()
    .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
ComposedArrayList validate(List<?> arg, SchemaConfiguration configuration)
ComposedArray1BoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
ComposedArray1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

ComposedArrayListBuilder

public class ComposedArrayListBuilder
builder for List<@Nullable Object>

A class that builds the List input type

Constructor Summary

Constructor and Description
ComposedArrayListBuilder()
Creates an empty list
ComposedArrayListBuilder(List<@Nullable Object> items)
Stores the items in a list

Method Summary

Modifier and Type Method and Description
ComposedArrayListBuilder add(Void item)
ComposedArrayListBuilder add(boolean item)
ComposedArrayListBuilder add(String item)
ComposedArrayListBuilder add(int item)
ComposedArrayListBuilder add(float item)
ComposedArrayListBuilder add(long item)
ComposedArrayListBuilder add(double item)
ComposedArrayListBuilder add(List<?> item)
ComposedArrayListBuilder add(Map<String, ?> item)
List<@Nullable Object> build()
Returns list input that should be used with Schema.validate

ComposedArrayList

public class ComposedArrayList
extends FrozenList<@Nullable Object>

A class to store validated List payloads

Method Summary

Modifier and Type Method and Description
static ComposedArrayList of(List<? extends @Nullable Object> arg, SchemaConfiguration configuration)

ItemsBoxed

public sealed interface ItemsBoxed
permits
ItemsBoxedVoid, ItemsBoxedBoolean, ItemsBoxedNumber, ItemsBoxedString, ItemsBoxedList, ItemsBoxedMap

sealed interface that stores validated payloads using boxed classes

ItemsBoxedVoid

public record ItemsBoxedVoid
implements ItemsBoxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedVoid(Void data)
Creates an instance, private visibility

Method Summary

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

ItemsBoxedBoolean

public record ItemsBoxedBoolean
implements ItemsBoxed

record that stores validated boolean payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility

Method Summary

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

ItemsBoxedNumber

public record ItemsBoxedNumber
implements ItemsBoxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedNumber(Number data)
Creates an instance, private visibility

Method Summary

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

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

ItemsBoxedList

public record ItemsBoxedList
implements ItemsBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenList<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

ItemsBoxedMap

public record ItemsBoxedMap
implements ItemsBoxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenMap<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

Items

public static class Items
extends AnyTypeJsonSchema.AnyTypeJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema.AnyTypeJsonSchema1
validate
validateAndBox

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