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

Latest commit

 

History

History
166 lines (131 loc) · 7.44 KB

File metadata and controls

166 lines (131 loc) · 7.44 KB

JSONPatchRequestAddReplaceTest

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

A class that contains necessary nested schema classes, and classes to store validated list and map payloads

Nested Class Summary

Modifier and Type Class and Description
static class JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1
schema class
static class JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap
output class for Map payloads
static class JSONPatchRequestAddReplaceTest.Op
schema class
static class JSONPatchRequestAddReplaceTest.Value
schema class
static class JSONPatchRequestAddReplaceTest.Path
schema class
static class JSONPatchRequestAddReplaceTest.AdditionalProperties
schema class

JSONPatchRequestAddReplaceTest1

public static class JSONPatchRequestAddReplaceTest1
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.MapMaker;
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
JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTestMap validatedPayload =
    JSONPatchRequestAddReplaceTest.JSONPatchRequestAddReplaceTest1.validate(
    MapMaker.makeMap(
        new AbstractMap.SimpleEntry<>(
            "op",
            "add"
        ),
        new AbstractMap.SimpleEntry<>(
            "path",
            "a"
        )
    ),
    configuration
);

Field Summary

Modifier and Type Field and Description
static LinkedHashMap<String, KeywordValidator> keywordToValidator
new LinkedHashMap<>(Map.ofEntries(
    new KeywordEntry("type", new TypeValidator(Set.of(FrozenMap.class))),
    new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
        new PropertyEntry("path", Path.class)),
        new PropertyEntry("value", Value.class)),
        new PropertyEntry("op", Op.class))
    ))),
    new KeywordEntry("required", new RequiredValidator(Set.of(
        "op",
        "path",
        "value"
    ))),
    new KeywordEntry("additionalProperties", new AdditionalPropertiesValidator(AdditionalProperties.class))
));

Method Summary

Modifier and Type Method and Description
static JSONPatchRequestAddReplaceTestMap validate(Map<String, Object> arg, SchemaConfiguration configuration)

JSONPatchRequestAddReplaceTestMap

public static class JSONPatchRequestAddReplaceTestMap
extends FrozenMap<String, Object>

A class to store validated Map payloads

Method Summary

Modifier and Type Method and Description
static JSONPatchRequestAddReplaceTestMap of(Map<String, Object> arg, SchemaConfiguration configuration)
String op()
must be one of ["add", "replace", "test"]
String path()
Object value()

Input Map Keys

type: Map<String, Object>
Key Type Description Notes
op String The operation to perform. must be one of ["add", "replace", "test"]
path String A JSON Pointer path.
value Object The value to add, replace or test.

Op

public static class Op
extends JsonSchema

A schema class that validates payloads

Description

The operation to perform.

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.MapMaker;
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());

// String validation
String validatedPayload = JSONPatchRequestAddReplaceTest.Op.validate(
    "add",
    configuration
);

Field Summary

Modifier and Type Field and Description
static LinkedHashMap<String, KeywordValidator> keywordToValidator
new LinkedHashMap<>(Map.ofEntries(
    new KeywordEntry("type", new TypeValidator(Set.of(
        String.class
    ))),
    new KeywordEntry("enum", new EnumValidator(Set.of(
        "add",
        "replace",
        "test"
)))
));

Method Summary

Modifier and Type Method and Description
static String validate(String arg, SchemaConfiguration configuration)

Value

public static class Value
extends AnyTypeJsonSchema

A schema class that validates payloads

Description

The value to add, replace or test.

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

Path

public static class Path
extends StringJsonSchema

A schema class that validates payloads

Description

A JSON Pointer path.

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

AdditionalProperties

public static class AdditionalProperties
extends NotAnyTypeJsonSchema

A schema class that validates payloads

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

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