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

Latest commit

 

History

History
215 lines (184 loc) · 9.99 KB

File metadata and controls

215 lines (184 loc) · 9.99 KB

Drawing

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

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

Nested Class Summary

Modifier and Type Class and Description
static class Drawing.Drawing1
schema class
static class Drawing.DrawingMapBuilder
builder for Map payloads
static class Drawing.DrawingMap
output class for Map payloads
static class Drawing.Shapes
schema class
static class Drawing.ShapesListBuilder
builder for List payloads
static class Drawing.ShapesList
output class for List payloads

Drawing1

public static class Drawing1
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
Drawing.DrawingMap validatedPayload =
    Drawing.Drawing1.validate(
    new Drawing.DrawingMapBuilder()
        .shapes(
            Arrays.asList(
            )
        )
    .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("mainShape", Shape.Shape1.class),
    new PropertyEntry("shapeOrNull", ShapeOrNull.ShapeOrNull1.class),
    new PropertyEntry("nullableShape", NullableShape.NullableShape1.class),
    new PropertyEntry("shapes", Shapes.class))
)
Class<? extends JsonSchema> additionalProperties = Fruit.Fruit1.class

Method Summary

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

DrawingMapBuilder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
DrawingMapBuilder()
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
DrawingMapBuilder mainShape(Void value)
DrawingMapBuilder mainShape(boolean value)
DrawingMapBuilder mainShape(String value)
DrawingMapBuilder mainShape(int value)
DrawingMapBuilder mainShape(float value)
DrawingMapBuilder mainShape(long value)
DrawingMapBuilder mainShape(double value)
DrawingMapBuilder mainShape(List<?> value)
DrawingMapBuilder mainShape(Map<String, ?> value)
DrawingMapBuilder shapeOrNull(Void value)
DrawingMapBuilder shapeOrNull(boolean value)
DrawingMapBuilder shapeOrNull(String value)
DrawingMapBuilder shapeOrNull(int value)
DrawingMapBuilder shapeOrNull(float value)
DrawingMapBuilder shapeOrNull(long value)
DrawingMapBuilder shapeOrNull(double value)
DrawingMapBuilder shapeOrNull(List<?> value)
DrawingMapBuilder shapeOrNull(Map<String, ?> value)
DrawingMapBuilder nullableShape(Void value)
DrawingMapBuilder nullableShape(boolean value)
DrawingMapBuilder nullableShape(String value)
DrawingMapBuilder nullableShape(int value)
DrawingMapBuilder nullableShape(float value)
DrawingMapBuilder nullableShape(long value)
DrawingMapBuilder nullableShape(double value)
DrawingMapBuilder nullableShape(List<?> value)
DrawingMapBuilder nullableShape(Map<String, ?> value)
DrawingMapBuilder shapes(List<@Nullable Object> value)
DrawingMapBuilder additionalProperty(String key, Void value)
DrawingMapBuilder additionalProperty(String key, boolean value)
DrawingMapBuilder additionalProperty(String key, String value)
DrawingMapBuilder additionalProperty(String key, int value)
DrawingMapBuilder additionalProperty(String key, float value)
DrawingMapBuilder additionalProperty(String key, long value)
DrawingMapBuilder additionalProperty(String key, double value)
DrawingMapBuilder additionalProperty(String key, List<?> value)
DrawingMapBuilder additionalProperty(String key, Map<String, ?> value)

DrawingMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static DrawingMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
@Nullable Object mainShape()
[optional]
@Nullable Object shapeOrNull()
[optional]
@Nullable Object nullableShape()
[optional]
ShapesList shapes()
[optional]
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

Shapes

public static class Shapes
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
Drawing.ShapesList validatedPayload =
    Drawing.Shapes.validate(
    new Drawing.ShapesListBuilder()
    .build(),
    configuration
);

Field Summary

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

Method Summary

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

ShapesListBuilder

public class ShapesListBuilder
builder for List<@Nullable Object>

A class that builds the List input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
ShapesListBuilder add(Void item)
ShapesListBuilder add(boolean item)
ShapesListBuilder add(String item)
ShapesListBuilder add(int item)
ShapesListBuilder add(float item)
ShapesListBuilder add(long item)
ShapesListBuilder add(double item)
ShapesListBuilder add(List<?> item)
ShapesListBuilder add(Map<String, ?> item)
List<@Nullable Object> build()
Returns list input that should be used with Schema.validate

ShapesList

public class ShapesList
extends FrozenList<@Nullable Object>

A class to store validated List payloads

Method Summary

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

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