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

Latest commit

 

History

History
178 lines (147 loc) · 8.09 KB

File metadata and controls

178 lines (147 loc) · 8.09 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
  • 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 FileSchemaTestClass.FileSchemaTestClass1
schema class
static class FileSchemaTestClass.FileSchemaTestClassMapBuilder
builder for Map payloads
static class FileSchemaTestClass.FileSchemaTestClassMap
output class for Map payloads
static class FileSchemaTestClass.Files
schema class
static class FileSchemaTestClass.FilesListBuilder
builder for List payloads
static class FileSchemaTestClass.FilesList
output class for List payloads

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

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