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

Latest commit

 

History

History
478 lines (377 loc) · 21.3 KB

File metadata and controls

478 lines (377 loc) · 21.3 KB

ObjectWithOnlyOptionalProps

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

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

Nested Class Summary

Modifier and Type Class and Description
sealed interface ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1Boxed
sealed interface for validated payloads
record ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1BoxedMap
boxed class to store validated Map payloads
static class ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1
schema class
static class ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder
builder for Map payloads
static class ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap
output class for Map payloads
sealed interface ObjectWithOnlyOptionalProps.ArrayPropertyBoxed
sealed interface for validated payloads
record ObjectWithOnlyOptionalProps.ArrayPropertyBoxedVoid
boxed class to store validated null payloads
record ObjectWithOnlyOptionalProps.ArrayPropertyBoxedList
boxed class to store validated List payloads
static class ObjectWithOnlyOptionalProps.ArrayProperty
schema class
static class ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder
builder for List payloads
static class ObjectWithOnlyOptionalProps.ArrayPropertyList
output class for List payloads
sealed interface ObjectWithOnlyOptionalProps.BBoxed
sealed interface for validated payloads
record ObjectWithOnlyOptionalProps.BBoxedNumber
boxed class to store validated Number payloads
static class ObjectWithOnlyOptionalProps.B
schema class
sealed interface ObjectWithOnlyOptionalProps.ABoxed
sealed interface for validated payloads
record ObjectWithOnlyOptionalProps.ABoxedString
boxed class to store validated String payloads
static class ObjectWithOnlyOptionalProps.A
schema class
sealed interface ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxed
sealed interface for validated payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedVoid
boxed class to store validated null payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedBoolean
boxed class to store validated boolean payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedNumber
boxed class to store validated Number payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedString
boxed class to store validated String payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedList
boxed class to store validated List payloads
record ObjectWithOnlyOptionalProps.AdditionalPropertiesBoxedMap
boxed class to store validated Map payloads
static class ObjectWithOnlyOptionalProps.AdditionalProperties
schema class

ObjectWithOnlyOptionalProps1Boxed

public sealed interface ObjectWithOnlyOptionalProps1Boxed
permits
ObjectWithOnlyOptionalProps1BoxedMap

sealed interface that stores validated payloads using boxed classes

ObjectWithOnlyOptionalProps1BoxedMap

public record ObjectWithOnlyOptionalProps1BoxedMap
implements ObjectWithOnlyOptionalProps1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ObjectWithOnlyOptionalProps1BoxedMap(ObjectWithOnlyOptionalPropsMap data)
Creates an instance, private visibility

Method Summary

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

ObjectWithOnlyOptionalProps1

public static class ObjectWithOnlyOptionalProps1
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.ObjectWithOnlyOptionalProps;

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

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

// Map validation
ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMap validatedPayload =
    ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalProps1.validate(
    new ObjectWithOnlyOptionalProps.ObjectWithOnlyOptionalPropsMapBuilder()
        .a("a")

        .b(1)

        .ArrayProperty(null)

    .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("a", A.class)),
    new PropertyEntry("b", B.class)),
    new PropertyEntry("ArrayProperty", ArrayProperty.class))
)
Class<? extends JsonSchema> additionalProperties = AdditionalProperties.class

Method Summary

Modifier and Type Method and Description
ObjectWithOnlyOptionalPropsMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
ObjectWithOnlyOptionalProps1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
ObjectWithOnlyOptionalProps1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

ObjectWithOnlyOptionalPropsMapBuilder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
ObjectWithOnlyOptionalPropsMapBuilder()
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
ObjectWithOnlyOptionalPropsMapBuilder a(String value)
ObjectWithOnlyOptionalPropsMapBuilder b(int value)
ObjectWithOnlyOptionalPropsMapBuilder b(float value)
ObjectWithOnlyOptionalPropsMapBuilder b(long value)
ObjectWithOnlyOptionalPropsMapBuilder b(double value)
ObjectWithOnlyOptionalPropsMapBuilder ArrayProperty(Void value)
ObjectWithOnlyOptionalPropsMapBuilder ArrayProperty(List value)

ObjectWithOnlyOptionalPropsMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static ObjectWithOnlyOptionalPropsMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
String a()
[optional]
Number b()
[optional]
ArrayPropertyList ArrayProperty()
[optional]

ArrayPropertyBoxed

public sealed interface ArrayPropertyBoxed
permits
ArrayPropertyBoxedVoid, ArrayPropertyBoxedList

sealed interface that stores validated payloads using boxed classes

ArrayPropertyBoxedVoid

public record ArrayPropertyBoxedVoid
implements ArrayPropertyBoxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

ArrayPropertyBoxedList

public record ArrayPropertyBoxedList
implements ArrayPropertyBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ArrayPropertyBoxedList(ArrayPropertyList data)
Creates an instance, private visibility

Method Summary

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

ArrayProperty

public static class ArrayProperty
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.ObjectWithOnlyOptionalProps;

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

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

// null validation
Void validatedPayload = ObjectWithOnlyOptionalProps.ArrayProperty.validate(
    (Void) null,
    configuration
);

// List validation
ObjectWithOnlyOptionalProps.ArrayPropertyList validatedPayload =
    ObjectWithOnlyOptionalProps.ArrayProperty.validate(
    new ObjectWithOnlyOptionalProps.ArrayPropertyListBuilder()
        .add("_abc")

    .build(),
    configuration
);

Field Summary

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

Method Summary

Modifier and Type Method and Description
Void validate(Void arg, SchemaConfiguration configuration)
ArrayPropertyBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration)
ArrayPropertyList validate(List<?> arg, SchemaConfiguration configuration)
ArrayPropertyBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
ArrayPropertyBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

ArrayPropertyListBuilder

public class ArrayPropertyListBuilder
builder for List<String>

A class that builds the List input type

Constructor Summary

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

Method Summary

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

ArrayPropertyList

public class ArrayPropertyList
extends FrozenList<String>

A class to store validated List payloads

Method Summary

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

BBoxed

public sealed interface BBoxed
permits
BBoxedNumber

sealed interface that stores validated payloads using boxed classes

BBoxedNumber

public record BBoxedNumber
implements BBoxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

B

public static class B
extends NumberJsonSchema.NumberJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema.NumberJsonSchema1
validate
validateAndBox

ABoxed

public sealed interface ABoxed
permits
ABoxedString

sealed interface that stores validated payloads using boxed classes

ABoxedString

public record ABoxedString
implements ABoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

A

public static class A
extends StringJsonSchema.StringJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1
validate
validateAndBox

AdditionalPropertiesBoxed

public sealed interface AdditionalPropertiesBoxed
permits
AdditionalPropertiesBoxedVoid, AdditionalPropertiesBoxedBoolean, AdditionalPropertiesBoxedNumber, AdditionalPropertiesBoxedString, AdditionalPropertiesBoxedList, AdditionalPropertiesBoxedMap

sealed interface that stores validated payloads using boxed classes

AdditionalPropertiesBoxedVoid

public record AdditionalPropertiesBoxedVoid
implements AdditionalPropertiesBoxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

AdditionalPropertiesBoxedBoolean

public record AdditionalPropertiesBoxedBoolean
implements AdditionalPropertiesBoxed

record that stores validated boolean payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

AdditionalPropertiesBoxedNumber

public record AdditionalPropertiesBoxedNumber
implements AdditionalPropertiesBoxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

AdditionalPropertiesBoxedString

public record AdditionalPropertiesBoxedString
implements AdditionalPropertiesBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

AdditionalPropertiesBoxedList

public record AdditionalPropertiesBoxedList
implements AdditionalPropertiesBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
AdditionalPropertiesBoxedList(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

AdditionalPropertiesBoxedMap

public record AdditionalPropertiesBoxedMap
implements AdditionalPropertiesBoxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
AdditionalPropertiesBoxedMap(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

AdditionalProperties

public static class AdditionalProperties
extends NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.NotAnyTypeJsonSchema.NotAnyTypeJsonSchema1
validate
validateAndBox

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