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

Latest commit

 

History

History
318 lines (255 loc) · 12.8 KB

File metadata and controls

318 lines (255 loc) · 12.8 KB

Apple

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

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 map payloads, extends FrozenMap
  • classes to build inputs for map payloads

Nested Class Summary

Modifier and Type Class and Description
sealed interface Apple.Apple1Boxed
sealed interface for validated payloads
record Apple.Apple1BoxedVoid
boxed class to store validated null payloads
record Apple.Apple1BoxedMap
boxed class to store validated Map payloads
static class Apple.Apple1
schema class
static class Apple.AppleMapBuilder
builder for Map payloads
static class Apple.AppleMap
output class for Map payloads
sealed interface Apple.OriginBoxed
sealed interface for validated payloads
record Apple.OriginBoxedString
boxed class to store validated String payloads
static class Apple.Origin
schema class
sealed interface Apple.CultivarBoxed
sealed interface for validated payloads
record Apple.CultivarBoxedString
boxed class to store validated String payloads
static class Apple.Cultivar
schema class

Apple1Boxed

public sealed interface Apple1Boxed
permits
Apple1BoxedVoid, Apple1BoxedMap

sealed interface that stores validated payloads using boxed classes

Apple1BoxedVoid

public record Apple1BoxedVoid
implements Apple1Boxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Apple1BoxedMap

public record Apple1BoxedMap
implements Apple1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Apple1BoxedMap(AppleMap data)
Creates an instance, private visibility

Method Summary

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

Apple1

public static class Apple1
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.Apple;

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 = Apple.Apple1.validate(
    (Void) null,
    configuration
);

// Map validation
Apple.AppleMap validatedPayload =
    Apple.Apple1.validate(
    new Apple.AppleMapBuilder()
        .cultivar("IaQn�EaqioxT	oASzjxaSH")

        .origin("IaQn�EaqioxT	oASzjxaSH")

    .build(),
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    Void.class,
    Map.class
)
Map<String, Class<? extends JsonSchema>> properties = Map.ofEntries(
    new PropertyEntry("cultivar", Cultivar.class)),
    new PropertyEntry("origin", Origin.class))
)
Set required = Set.of(
    "cultivar"
)

Method Summary

Modifier and Type Method and Description
Void validate(Void arg, SchemaConfiguration configuration)
Apple1BoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration)
AppleMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
Apple1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
Apple1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

AppleMap0Builder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
AppleMap0Builder(Map<String, @Nullable Object> instance)
Creates a builder that contains the passed instance

Method Summary

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

AppleMapBuilder

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

A class that builds the Map input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
AppleMap0Builder cultivar(String value)

AppleMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static AppleMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
String cultivar()
String origin()
[optional]
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

OriginBoxed

public sealed interface OriginBoxed
permits
OriginBoxedString

sealed interface that stores validated payloads using boxed classes

OriginBoxedString

public record OriginBoxedString
implements OriginBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Origin

public static class Origin
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.Apple;

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 = Apple.Origin.validate(
    "IaQn�EaqioxT	oASzjxaSH",
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    String.class
)
Pattern pattern = Pattern.compile(
    "^[A-Z\s]*$",
    Pattern.CASE_INSENSITIVE
)

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
OriginBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
OriginBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

CultivarBoxed

public sealed interface CultivarBoxed
permits
CultivarBoxedString

sealed interface that stores validated payloads using boxed classes

CultivarBoxedString

public record CultivarBoxedString
implements CultivarBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Cultivar

public static class Cultivar
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.Apple;

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 = Apple.Cultivar.validate(
    "IaQn�EaqioxT	oASzjxaSH",
    configuration
);

Field Summary

Modifier and Type Field and Description
Set<Class<?>> type = Set.of(
    String.class
)
Pattern pattern = Pattern.compile(
    "^[a-zA-Z\s]*$"
)

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
CultivarBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
CultivarBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

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