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

Latest commit

 

History

History
282 lines (228 loc) · 12.4 KB

File metadata and controls

282 lines (228 loc) · 12.4 KB

JSONPatchRequest

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

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

Nested Class Summary

Modifier and Type Class and Description
sealed interface JSONPatchRequest.JSONPatchRequest1Boxed
sealed interface for validated payloads
record JSONPatchRequest.JSONPatchRequest1BoxedList
boxed class to store validated List payloads
static class JSONPatchRequest.JSONPatchRequest1
schema class
static class JSONPatchRequest.JSONPatchRequestListBuilder
builder for List payloads
static class JSONPatchRequest.JSONPatchRequestList
output class for List payloads
sealed interface JSONPatchRequest.ItemsBoxed
sealed interface for validated payloads
record JSONPatchRequest.ItemsBoxedVoid
boxed class to store validated null payloads
record JSONPatchRequest.ItemsBoxedBoolean
boxed class to store validated boolean payloads
record JSONPatchRequest.ItemsBoxedNumber
boxed class to store validated Number payloads
record JSONPatchRequest.ItemsBoxedString
boxed class to store validated String payloads
record JSONPatchRequest.ItemsBoxedList
boxed class to store validated List payloads
record JSONPatchRequest.ItemsBoxedMap
boxed class to store validated Map payloads
static class JSONPatchRequest.Items
schema class

JSONPatchRequest1Boxed

public sealed interface JSONPatchRequest1Boxed
permits
JSONPatchRequest1BoxedList

sealed interface that stores validated payloads using boxed classes

JSONPatchRequest1BoxedList

public record JSONPatchRequest1BoxedList
implements JSONPatchRequest1Boxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
JSONPatchRequest1BoxedList(JSONPatchRequestList data)
Creates an instance, private visibility

Method Summary

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

JSONPatchRequest1

public static class JSONPatchRequest1
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.JSONPatchRequest;

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

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

// List validation
JSONPatchRequest.JSONPatchRequestList validatedPayload =
    JSONPatchRequest.JSONPatchRequest1.validate(
    new JSONPatchRequest.JSONPatchRequestListBuilder()
    .build(),
    configuration
);

Field Summary

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

Method Summary

Modifier and Type Method and Description
JSONPatchRequestList validate(List<?> arg, SchemaConfiguration configuration)
JSONPatchRequest1BoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
JSONPatchRequest1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

JSONPatchRequestListBuilder

public class JSONPatchRequestListBuilder
builder for List<@Nullable Object>

A class that builds the List input type

Constructor Summary

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

Method Summary

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

JSONPatchRequestList

public class JSONPatchRequestList
extends FrozenList<@Nullable Object>

A class to store validated List payloads

Method Summary

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

ItemsBoxed

public sealed interface ItemsBoxed
permits
ItemsBoxedVoid, ItemsBoxedBoolean, ItemsBoxedNumber, ItemsBoxedString, ItemsBoxedList, ItemsBoxedMap

sealed interface that stores validated payloads using boxed classes

ItemsBoxedVoid

public record ItemsBoxedVoid
implements ItemsBoxed

record that stores validated null payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedVoid(Void data)
Creates an instance, private visibility

Method Summary

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

ItemsBoxedBoolean

public record ItemsBoxedBoolean
implements ItemsBoxed

record that stores validated boolean payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedBoolean(boolean data)
Creates an instance, private visibility

Method Summary

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

ItemsBoxedNumber

public record ItemsBoxedNumber
implements ItemsBoxed

record that stores validated Number payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedNumber(Number data)
Creates an instance, private visibility

Method Summary

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

ItemsBoxedString

public record ItemsBoxedString
implements ItemsBoxed

record that stores validated String payloads, sealed permits implementation

Constructor Summary

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

Method Summary

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

ItemsBoxedList

public record ItemsBoxedList
implements ItemsBoxed

record that stores validated List payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedList(FrozenList<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenList<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

ItemsBoxedMap

public record ItemsBoxedMap
implements ItemsBoxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ItemsBoxedMap(FrozenMap<@Nullable Object> data)
Creates an instance, private visibility

Method Summary

Modifier and Type Method and Description
FrozenMap<@Nullable Object> data()
validated payload
@Nullable Object getData()
validated payload

Items

public static class Items
extends JsonSchema

A schema class that validates payloads

Field Summary

Modifier and Type Field and Description
List<Class<? extends JsonSchema>> oneOf = List.of(
    JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.class,
    JSONPatchRequestRemove.JSONPatchRequestRemove1.class,
    JSONPatchRequestMoveCopy.JSONPatchRequestMoveCopy1.class
))

Method Summary

Modifier and Type Method and Description
String validate(String arg, SchemaConfiguration configuration)
Void validate(Void arg, SchemaConfiguration configuration)
int validate(int arg, SchemaConfiguration configuration)
long validate(long arg, SchemaConfiguration configuration)
float validate(float arg, SchemaConfiguration configuration)
double validate(double arg, SchemaConfiguration configuration)
Number validate(Number arg, SchemaConfiguration configuration)
boolean validate(boolean arg, SchemaConfiguration configuration)
FrozenMap<@Nullable Object> validate(Map<?, ?> arg, SchemaConfiguration configuration)
FrozenList<@Nullable Object> validate(List<?> arg, SchemaConfiguration configuration)
ItemsBoxedString validateAndBox(String arg, SchemaConfiguration configuration)
ItemsBoxedVoid validateAndBox(Void arg, SchemaConfiguration configuration)
ItemsBoxedNumber validateAndBox(Number arg, SchemaConfiguration configuration)
ItemsBoxedBoolean validateAndBox(boolean arg, SchemaConfiguration configuration)
ItemsBoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
ItemsBoxedList validateAndBox(List<?> arg, SchemaConfiguration configuration)
ItemsBoxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

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