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

Latest commit

 

History

History
172 lines (137 loc) · 7.24 KB

File metadata and controls

172 lines (137 loc) · 7.24 KB

PublicKey

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

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 map payloads, extends FrozenMap
  • classes to build inputs for map payloads

Nested Class Summary

Modifier and Type Class and Description
sealed interface PublicKey.PublicKey1Boxed
sealed interface for validated payloads
record PublicKey.PublicKey1BoxedMap
boxed class to store validated Map payloads
static class PublicKey.PublicKey1
schema class
static class PublicKey.PublicKeyMapBuilder
builder for Map payloads
static class PublicKey.PublicKeyMap
output class for Map payloads
sealed interface PublicKey.KeyBoxed
sealed interface for validated payloads
record PublicKey.KeyBoxedString
boxed class to store validated String payloads
static class PublicKey.Key
schema class

PublicKey1Boxed

public sealed interface PublicKey1Boxed
permits
PublicKey1BoxedMap

sealed interface that stores validated payloads using boxed classes

PublicKey1BoxedMap

public record PublicKey1BoxedMap
implements PublicKey1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
PublicKey1BoxedMap(PublicKeyMap data)
Creates an instance, private visibility

Method Summary

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

PublicKey1

public static class PublicKey1
extends JsonSchema

A schema class that validates payloads

Description

schema that contains a property named key

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.PublicKey;

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

static final SchemaConfiguration configuration = new SchemaConfiguration(new JsonSchemaKeywordFlags.Builder().build());

// Map validation
PublicKey.PublicKeyMap validatedPayload =
    PublicKey.PublicKey1.validate(
    new PublicKey.PublicKeyMapBuilder()
        .key("a")

    .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("key", Key.class))
)

Method Summary

Modifier and Type Method and Description
PublicKeyMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
PublicKey1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
PublicKey1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

PublicKeyMapBuilder

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

A class that builds the Map input type

Constructor Summary

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

PublicKeyMap

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

A class to store validated Map payloads

Method Summary

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

KeyBoxed

public sealed interface KeyBoxed
permits
KeyBoxedString

sealed interface that stores validated payloads using boxed classes

KeyBoxedString

public record KeyBoxedString
implements KeyBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

Constructor and Description
KeyBoxedString(String data)
Creates an instance, private visibility

Method Summary

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

Key

public static class Key
extends StringJsonSchema.StringJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema.StringJsonSchema1
validate
validateAndBox

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