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

Latest commit

 

History

History
240 lines (195 loc) · 11.1 KB

File metadata and controls

240 lines (195 loc) · 11.1 KB

FileSchemaTestClass

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

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

Nested Class Summary

Modifier and Type Class and Description
sealed interface FileSchemaTestClass.FileSchemaTestClass1Boxed
sealed interface for validated payloads
record FileSchemaTestClass.FileSchemaTestClass1BoxedMap
boxed class to store validated Map payloads
static class FileSchemaTestClass.FileSchemaTestClass1
schema class
static class FileSchemaTestClass.FileSchemaTestClassMapBuilder
builder for Map payloads
static class FileSchemaTestClass.FileSchemaTestClassMap
output class for Map payloads
sealed interface FileSchemaTestClass.FilesBoxed
sealed interface for validated payloads
record FileSchemaTestClass.FilesBoxedList
boxed class to store validated List payloads
static class FileSchemaTestClass.Files
schema class
static class FileSchemaTestClass.FilesListBuilder
builder for List payloads
static class FileSchemaTestClass.FilesList
output class for List payloads

FileSchemaTestClass1Boxed

public sealed interface FileSchemaTestClass1Boxed
permits
FileSchemaTestClass1BoxedMap

sealed interface that stores validated payloads using boxed classes

FileSchemaTestClass1BoxedMap

public record FileSchemaTestClass1BoxedMap
implements FileSchemaTestClass1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
FileSchemaTestClass1BoxedMap(FileSchemaTestClassMap data)
Creates an instance, private visibility

Method Summary

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

FileSchemaTestClass1

public static class FileSchemaTestClass1
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.FileSchemaTestClass;

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

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

// Map validation
FileSchemaTestClass.FileSchemaTestClassMap validatedPayload =
    FileSchemaTestClass.FileSchemaTestClass1.validate(
    new FileSchemaTestClass.FileSchemaTestClassMapBuilder()
        .files(
            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("file", File.File1.class),
    new PropertyEntry("files", Files.class))
)

Method Summary

Modifier and Type Method and Description
FileSchemaTestClassMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
FileSchemaTestClass1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
FileSchemaTestClass1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

FileSchemaTestClassMapBuilder

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

A class that builds the Map input type

Constructor Summary

Constructor and Description
FileSchemaTestClassMapBuilder()
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
FileSchemaTestClassMapBuilder file(Map<String, @Nullable Object> value)
FileSchemaTestClassMapBuilder files(List<Map<String, @Nullable Object>> value)
FileSchemaTestClassMapBuilder additionalProperty(String key, Void value)
FileSchemaTestClassMapBuilder additionalProperty(String key, boolean value)
FileSchemaTestClassMapBuilder additionalProperty(String key, String value)
FileSchemaTestClassMapBuilder additionalProperty(String key, int value)
FileSchemaTestClassMapBuilder additionalProperty(String key, float value)
FileSchemaTestClassMapBuilder additionalProperty(String key, long value)
FileSchemaTestClassMapBuilder additionalProperty(String key, double value)
FileSchemaTestClassMapBuilder additionalProperty(String key, List<?> value)
FileSchemaTestClassMapBuilder additionalProperty(String key, Map<String, ?> value)

FileSchemaTestClassMap

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

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static FileSchemaTestClassMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration)
File.FileMap file()
[optional]
FilesList files()
[optional]
@Nullable Object getAdditionalProperty(String name)
provides type safety for additional properties

FilesBoxed

public sealed interface FilesBoxed
permits
FilesBoxedList

sealed interface that stores validated payloads using boxed classes

FilesBoxedList

public record FilesBoxedList
implements FilesBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
FilesBoxedList(FilesList data)
Creates an instance, private visibility

Method Summary

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

Files

public static class Files
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.FileSchemaTestClass;

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

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

// List validation
FileSchemaTestClass.FilesList validatedPayload =
    FileSchemaTestClass.Files.validate(
    new FileSchemaTestClass.FilesListBuilder()
    .build(),
    configuration
);

Field Summary

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

Method Summary

Modifier and Type Method and Description
FilesList validate(List<?> arg, SchemaConfiguration configuration)
FilesBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
FilesBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

FilesListBuilder

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

A class that builds the List input type

Constructor Summary

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

Method Summary

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

FilesList

public class FilesList
extends FrozenList<File.FileMap>

A class to store validated List payloads

Method Summary

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

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