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

Latest commit

 

History

History
135 lines (111 loc) · 5.92 KB

File metadata and controls

135 lines (111 loc) · 5.92 KB

Cat

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

A class that contains necessary nested

  • schema classes (which validate payloads), extends JsonSchema
  • classes to store validated map payloads, extends FrozenMap
  • classes to build inputs for map payloads

Nested Class Summary

Modifier and Type Class and Description
static class Cat.Cat1
schema class
static class Cat.Schema1
schema class
static class Cat.Schema1MapBuilder
builder for Map payloads
static class Cat.Schema1Map
output class for Map payloads
static class Cat.Declawed
schema class

Cat1

public static class Cat1
extends JsonSchema

A schema class that validates payloads

Field Summary

Modifier and Type Field and Description
List<Class<? extends JsonSchema>> allOf = List.of(
    Animal.Animal1.class,
    Schema1.class
;)

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
Void validate(Void arg, SchemaConfiguration configuration)
int validate(int arg, SchemaConfiguration configuration)
long validate(long arg, SchemaConfiguration configuration)
float validate(float arg, SchemaConfiguration configuration)
double validate(double arg, SchemaConfiguration configuration)
boolean validate(boolean arg, SchemaConfiguration configuration)
FrozenMap<String, @Nullable Object> validate(Map<?, ?> arg, SchemaConfiguration configuration)
FrozenList<@Nullable Object> validate(List<?> arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

Schema1

public static class Schema1
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());

// Map validation
Cat.Schema1Map validatedPayload =
    Cat.Schema1.validate(
    new Cat.Schema1MapBuilder()
        .declawed(true)

    .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("declawed", Declawed.class))
)

Method Summary

Modifier and Type Method and Description
Schema1Map validate(Map<?, ?> arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

Schema1MapBuilder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
Schema1MapBuilder()
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
Schema1MapBuilder declawed(boolean value)
Schema1MapBuilder additionalProperty(String key, Void value)
Schema1MapBuilder additionalProperty(String key, boolean value)
Schema1MapBuilder additionalProperty(String key, String value)
Schema1MapBuilder additionalProperty(String key, int value)
Schema1MapBuilder additionalProperty(String key, float value)
Schema1MapBuilder additionalProperty(String key, long value)
Schema1MapBuilder additionalProperty(String key, double value)
Schema1MapBuilder additionalProperty(String key, List<?> value)
Schema1MapBuilder additionalProperty(String key, Map<String, ?> value)

Schema1Map

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

A class to store validated Map payloads

Method Summary

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

Declawed

public static class Declawed
extends BooleanJsonSchema

A schema class that validates payloads

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

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