Skip to content

Latest commit

 

History

History
652 lines (524 loc) · 24.7 KB

File metadata and controls

652 lines (524 loc) · 24.7 KB

Pet

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

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 Pet.Pet1Boxed
sealed interface for validated payloads
record Pet.Pet1BoxedMap
boxed class to store validated Map payloads
static class Pet.Pet1
schema class
static class Pet.PetMapBuilder
builder for Map payloads
static class Pet.PetMap
output class for Map payloads
sealed interface Pet.TagsBoxed
sealed interface for validated payloads
record Pet.TagsBoxedList
boxed class to store validated List payloads
static class Pet.Tags
schema class
static class Pet.TagsListBuilder
builder for List payloads
static class Pet.TagsList
output class for List payloads
sealed interface Pet.StatusBoxed
sealed interface for validated payloads
record Pet.StatusBoxedString
boxed class to store validated String payloads
static class Pet.Status
schema class
enum Pet.StringStatusEnums
String enum
sealed interface Pet.PhotoUrlsBoxed
sealed interface for validated payloads
record Pet.PhotoUrlsBoxedList
boxed class to store validated List payloads
static class Pet.PhotoUrls
schema class
static class Pet.PhotoUrlsListBuilder
builder for List payloads
static class Pet.PhotoUrlsList
output class for List payloads
sealed interface Pet.ItemsBoxed
sealed interface for validated payloads
record Pet.ItemsBoxedString
boxed class to store validated String payloads
static class Pet.Items
schema class
sealed interface Pet.NameBoxed
sealed interface for validated payloads
record Pet.NameBoxedString
boxed class to store validated String payloads
static class Pet.Name
schema class
sealed interface Pet.IdBoxed
sealed interface for validated payloads
record Pet.IdBoxedNumber
boxed class to store validated Number payloads
static class Pet.Id
schema class

Pet1Boxed

public sealed interface Pet1Boxed
permits
Pet1BoxedMap

sealed interface that stores validated payloads using boxed classes

Pet1BoxedMap

public record Pet1BoxedMap
implements Pet1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
Pet1BoxedMap(PetMap data)
Creates an instance, private visibility

Method Summary

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

Pet1

public static class Pet1
extends JsonSchema

A schema class that validates payloads

Description

Pet object that needs to be added to the store

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

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

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

// Map validation
Pet.PetMap validatedPayload =
    Pet.Pet1.validate(
    new Pet.PetMapBuilder()
        .name("a")

        .photoUrls(
            Arrays.asList(
                "a"
            )
        )
        .id(1L)

        .category(
            MapUtils.makeMap(
                new AbstractMap.SimpleEntry<String, Object>(
                    "name",
                    "a"
                ),
                new AbstractMap.SimpleEntry<String, Object>(
                    "id",
                    1L
                )
            )
        )
        .tags(
            Arrays.asList(
                MapUtils.makeMap(
                    new AbstractMap.SimpleEntry<String, String>(
                        "name",
                        "a"
                    )
                )
            )
        )
        .status("available")

    .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("id", Id.class)),
    new PropertyEntry("category", Category.Category1.class),
    new PropertyEntry("name", Name.class)),
    new PropertyEntry("photoUrls", PhotoUrls.class)),
    new PropertyEntry("tags", Tags.class)),
    new PropertyEntry("status", Status.class))
)
Set required = Set.of(
    "name",
    "photoUrls"
)

Method Summary

Modifier and Type Method and Description
PetMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
Pet1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
Pet1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

PetMap00Builder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
PetMap00Builder(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
PetMap00Builder id(int value)
PetMap00Builder id(float value)
PetMap00Builder id(long value)
PetMap00Builder id(double value)
PetMap00Builder category(Map<String, @Nullable Object> value)
PetMap00Builder tags(List<Map<String, @Nullable Object>> value)
PetMap00Builder status(String value)
PetMap00Builder status(StringStatusEnums value)
PetMap00Builder additionalProperty(String key, Void value)
PetMap00Builder additionalProperty(String key, boolean value)
PetMap00Builder additionalProperty(String key, String value)
PetMap00Builder additionalProperty(String key, int value)
PetMap00Builder additionalProperty(String key, float value)
PetMap00Builder additionalProperty(String key, long value)
PetMap00Builder additionalProperty(String key, double value)
PetMap00Builder additionalProperty(String key, List<?> value)
PetMap00Builder additionalProperty(String key, Map<String, ?> value)

PetMap01Builder

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

A class that builds the Map input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
PetMap00Builder photoUrls(List value)

PetMap10Builder

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

A class that builds the Map input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
PetMap00Builder name(String value)

PetMapBuilder

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

A class that builds the Map input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
PetMap01Builder name(String value)
PetMap10Builder photoUrls(List value)

PetMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static PetMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
String name()
PhotoUrlsList photoUrls()
Number id()
[optional] value must be a 64 bit integer
Category.CategoryMap category()
[optional]
TagsList tags()
[optional]
String status()
[optional] must be one of ["available", "pending", "sold"]
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

TagsBoxed

public sealed interface TagsBoxed
permits
TagsBoxedList

sealed interface that stores validated payloads using boxed classes

TagsBoxedList

public record TagsBoxedList
implements TagsBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
TagsBoxedList(TagsList data)
Creates an instance, private visibility

Method Summary

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

Tags

public static class Tags
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.Pet;

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

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

// List validation
Pet.TagsList validatedPayload =
    Pet.Tags.validate(
    new Pet.TagsListBuilder()
        .add(
            MapUtils.makeMap(
                new AbstractMap.SimpleEntry<String, Object>(
                    "id",
                    1L
                ),
                new AbstractMap.SimpleEntry<String, Object>(
                    "name",
                    "a"
                )
            )
        )
    .build(),
    configuration
);

Field Summary

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

Method Summary

Modifier and Type Method and Description
TagsList validate(List<?> arg, SchemaConfiguration configuration)
TagsBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
TagsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

TagsListBuilder

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

A class that builds the List input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
TagsListBuilder add(Map<String, @Nullable Object> item)
List<Map<String, @Nullable Object>> build()
Returns list input that should be used with Schema.validate

TagsList

public class TagsList
extends FrozenList<Tag.TagMap>

A class to store validated List payloads

Method Summary

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

StatusBoxed

public sealed interface StatusBoxed
permits
StatusBoxedString

sealed interface that stores validated payloads using boxed classes

StatusBoxedString

public record StatusBoxedString
implements StatusBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Status

public static class Status
extends JsonSchema

A schema class that validates payloads

Description

pet status in the store

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

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 = Pet.Status.validate(
    "available",
    configuration
);

Field Summary

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

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
String validate(StringStatusEnums arg, SchemaConfiguration configuration)
StatusBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
StatusBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

StringStatusEnums

public enum StringStatusEnums
extends Enum<StringStatusEnums>

A class that stores String enum values

Enum Constant Summary

Enum Constant Description
AVAILABLE value = "available"
PENDING value = "pending"
SOLD value = "sold"

PhotoUrlsBoxed

public sealed interface PhotoUrlsBoxed
permits
PhotoUrlsBoxedList

sealed interface that stores validated payloads using boxed classes

PhotoUrlsBoxedList

public record PhotoUrlsBoxedList
implements PhotoUrlsBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
PhotoUrlsBoxedList(PhotoUrlsList data)
Creates an instance, private visibility

Method Summary

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

PhotoUrls

public static class PhotoUrls
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.Pet;

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

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

// List validation
Pet.PhotoUrlsList validatedPayload =
    Pet.PhotoUrls.validate(
    new Pet.PhotoUrlsListBuilder()
        .add("a")

    .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
PhotoUrlsList validate(List<?> arg, SchemaConfiguration configuration)
PhotoUrlsBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
PhotoUrlsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

PhotoUrlsListBuilder

public class PhotoUrlsListBuilder
builder for List<String>

A class that builds the List input type

Constructor Summary

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

Method Summary

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

PhotoUrlsList

public class PhotoUrlsList
extends FrozenList<String>

A class to store validated List payloads

Method Summary

Modifier and Type Method and Description
static PhotoUrlsList 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 StringJsonSchema.StringJsonSchema1

A schema class that validates payloads

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

NameBoxed

public sealed interface NameBoxed
permits
NameBoxedString

sealed interface that stores validated payloads using boxed classes

NameBoxedString

public record NameBoxedString
implements NameBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Name

public static class Name
extends StringJsonSchema.StringJsonSchema1

A schema class that validates payloads

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

IdBoxed

public sealed interface IdBoxed
permits
IdBoxedNumber

sealed interface that stores validated payloads using boxed classes

IdBoxedNumber

public record IdBoxedNumber
implements IdBoxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

Id

public static class Id
extends Int64JsonSchema.Int64JsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema.Int64JsonSchema1
validate
validateAndBox

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