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

Latest commit

 

History

History
210 lines (167 loc) · 10.7 KB

ObjectWithCollidingProperties.md

File metadata and controls

210 lines (167 loc) · 10.7 KB

ObjectWithCollidingProperties

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

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 ObjectWithCollidingProperties.ObjectWithCollidingProperties1Boxed
sealed interface for validated payloads
record ObjectWithCollidingProperties.ObjectWithCollidingProperties1BoxedMap
boxed class to store validated Map payloads
static class ObjectWithCollidingProperties.ObjectWithCollidingProperties1
schema class
static class ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder
builder for Map payloads
static class ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap
output class for Map payloads
sealed interface ObjectWithCollidingProperties.SomepropBoxed
sealed interface for validated payloads
record ObjectWithCollidingProperties.SomepropBoxedMap
boxed class to store validated Map payloads
static class ObjectWithCollidingProperties.Someprop
schema class
sealed interface ObjectWithCollidingProperties.SomePropBoxed
sealed interface for validated payloads
record ObjectWithCollidingProperties.SomePropBoxedMap
boxed class to store validated Map payloads
static class ObjectWithCollidingProperties.SomeProp
schema class

ObjectWithCollidingProperties1Boxed

public sealed interface ObjectWithCollidingProperties1Boxed
permits
ObjectWithCollidingProperties1BoxedMap

sealed interface that stores validated payloads using boxed classes

ObjectWithCollidingProperties1BoxedMap

public record ObjectWithCollidingProperties1BoxedMap
implements ObjectWithCollidingProperties1Boxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
ObjectWithCollidingProperties1BoxedMap(ObjectWithCollidingPropertiesMap data)
Creates an instance, private visibility

Method Summary

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

ObjectWithCollidingProperties1

public static class ObjectWithCollidingProperties1
extends JsonSchema

A schema class that validates payloads

Description

component with properties that have name collisions

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

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

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

// Map validation
ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMap validatedPayload =
    ObjectWithCollidingProperties.ObjectWithCollidingProperties1.validate(
    new ObjectWithCollidingProperties.ObjectWithCollidingPropertiesMapBuilder()
    .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("someProp", SomeProp.class)),
    new PropertyEntry("someprop", Someprop.class))
)

Method Summary

Modifier and Type Method and Description
ObjectWithCollidingPropertiesMap validate(Map<?, ?> arg, SchemaConfiguration configuration)
ObjectWithCollidingProperties1BoxedMap validateAndBox(Map<?, ?> arg, SchemaConfiguration configuration)
ObjectWithCollidingProperties1Boxed validateAndBox(@Nullable Object arg, SchemaConfiguration configuration)
@Nullable Object validate(@Nullable Object arg, SchemaConfiguration configuration)

ObjectWithCollidingPropertiesMapBuilder

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

A class that builds the Map input type

Constructor Summary

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

ObjectWithCollidingPropertiesMap

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

A class to store validated Map payloads

Method Summary

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

SomepropBoxed

public sealed interface SomepropBoxed
permits
SomepropBoxedMap

sealed interface that stores validated payloads using boxed classes

SomepropBoxedMap

public record SomepropBoxedMap
implements SomepropBoxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
SomepropBoxedMap(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

Someprop

public static class Someprop
extends MapJsonSchema.MapJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1
validate
validateAndBox

SomePropBoxed

public sealed interface SomePropBoxed
permits
SomePropBoxedMap

sealed interface that stores validated payloads using boxed classes

SomePropBoxedMap

public record SomePropBoxedMap
implements SomePropBoxed

record that stores validated Map payloads, sealed permits implementation

Constructor Summary

Constructor and Description
SomePropBoxedMap(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

SomeProp

public static class SomeProp
extends MapJsonSchema.MapJsonSchema1

A schema class that validates payloads

Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema.MapJsonSchema1
validate
validateAndBox

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