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

Latest commit

 

History

History
449 lines (367 loc) · 16.7 KB

File metadata and controls

449 lines (367 loc) · 16.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
  • 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
static class Pet.Pet1
schema class
static class Pet.PetMapBuilder
builder for Map payloads
static class Pet.PetMap
output class for Map payloads
static class Pet.Tags
schema class
static class Pet.TagsListBuilder
builder for List payloads
static class Pet.TagsList
output class for List payloads
static class Pet.Status
schema class
enum Pet.StringStatusEnums
String enum
static class Pet.PhotoUrls
schema class
static class Pet.PhotoUrlsListBuilder
builder for List payloads
static class Pet.PhotoUrlsList
output class for List payloads
static class Pet.Items
schema class
static class Pet.Name
schema class
static class Pet.Id
schema class

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 java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());

// 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<>(
                        "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)
@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

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 java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());

// 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)
@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)

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 java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());

// 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)
@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"

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 java.util.Arrays;
import java.util.List;
import java.util.AbstractMap;

static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());

// 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)
@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)

Items

public static class Items
extends StringJsonSchema

A schema class that validates payloads

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

Name

public static class Name
extends StringJsonSchema

A schema class that validates payloads

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

Id

public static class Id
extends Int64JsonSchema

A schema class that validates payloads

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

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