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

Latest commit

 

History

History
129 lines (104 loc) · 5.33 KB

File metadata and controls

129 lines (104 loc) · 5.33 KB

Banana

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

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 Banana.Banana1
schema class
static class Banana.BananaMapBuilder
builder for Map payloads
static class Banana.BananaMap
output class for Map payloads
static class Banana.LengthCm
schema class

Banana1

public static class Banana1
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
Banana.BananaMap validatedPayload =
    Banana.Banana1.validate(
    new Banana.BananaMapBuilder()
        .lengthCm(1)

    .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("lengthCm", LengthCm.class))
)
Set required = Set.of(
    "lengthCm"
)

Method Summary

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

BananaMap0Builder

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

A class that builds the Map input type

Constructor Summary

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

BananaMapBuilder

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

A class that builds the Map input type

Constructor Summary

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

Method Summary

Modifier and Type Method and Description
BananaMap0Builder lengthCm(int value)
BananaMap0Builder lengthCm(float value)
BananaMap0Builder lengthCm(long value)
BananaMap0Builder lengthCm(double value)

BananaMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static BananaMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
Number lengthCm()
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

LengthCm

public static class LengthCm
extends NumberJsonSchema

A schema class that validates payloads

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

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