org.openapijsonschematools.client.components.schemas.User.java public class User
A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema
- classes to store validated map payloads, extends FrozenMap
- classes to build inputs for map payloads
Modifier and Type | Class and Description |
---|---|
static class | User.User1 schema class |
static class | User.UserMapBuilder builder for Map payloads |
static class | User.UserMap output class for Map payloads |
static class | User.AnyTypePropNullable schema class |
static class | User.AnyTypeExceptNullProp schema class |
static class | User.Not schema class |
static class | User.AnyTypeProp schema class |
static class | User.ObjectWithNoDeclaredPropsNullable schema class |
static class | User.ObjectWithNoDeclaredProps schema class |
static class | User.UserStatus schema class |
static class | User.Phone schema class |
static class | User.Password schema class |
static class | User.Email schema class |
static class | User.LastName schema class |
static class | User.FirstName schema class |
static class | User.Username schema class |
static class | User.Id schema class |
public static class User1
extends JsonSchema
A schema class that validates payloads
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
User.UserMap validatedPayload =
User.User1.validate(
new User.UserMapBuilder()
.id(1L)
.username("a")
.firstName("a")
.lastName("a")
.email("a")
.password("a")
.phone("a")
.userStatus(1)
.objectWithNoDeclaredPropsNullable(null)
.build(),
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of(Map.class) |
Map<String, Class<? extends JsonSchema>> | properties = Map.ofEntries( new PropertyEntry("id", Id.class)), new PropertyEntry("username", Username.class)), new PropertyEntry("firstName", FirstName.class)), new PropertyEntry("lastName", LastName.class)), new PropertyEntry("email", Email.class)), new PropertyEntry("password", Password.class)), new PropertyEntry("phone", Phone.class)), new PropertyEntry("userStatus", UserStatus.class)), new PropertyEntry("objectWithNoDeclaredProps", ObjectWithNoDeclaredProps.class)), new PropertyEntry("objectWithNoDeclaredPropsNullable", ObjectWithNoDeclaredPropsNullable.class)), new PropertyEntry("anyTypeProp", AnyTypeProp.class)), new PropertyEntry("anyTypeExceptNullProp", AnyTypeExceptNullProp.class)), new PropertyEntry("anyTypePropNullable", AnyTypePropNullable.class)) ) |
Modifier and Type | Method and Description |
---|---|
UserMap | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public class UserMapBuilder
builder for Map<String, @Nullable Object>
A class that builds the Map input type
Constructor and Description |
---|
UserMapBuilder() Creates a builder that contains an empty map |
Modifier and Type | Method and Description |
---|---|
Map<String, @Nullable Object> | build() Returns map input that should be used with Schema.validate |
UserMapBuilder | id(int value) |
UserMapBuilder | id(float value) |
UserMapBuilder | id(long value) |
UserMapBuilder | id(double value) |
UserMapBuilder | username(String value) |
UserMapBuilder | firstName(String value) |
UserMapBuilder | lastName(String value) |
UserMapBuilder | email(String value) |
UserMapBuilder | password(String value) |
UserMapBuilder | phone(String value) |
UserMapBuilder | userStatus(int value) |
UserMapBuilder | userStatus(float value) |
UserMapBuilder | objectWithNoDeclaredProps(Map<String, @Nullable Object> value) |
UserMapBuilder | objectWithNoDeclaredPropsNullable(Void value) |
UserMapBuilder | objectWithNoDeclaredPropsNullable(Map<String, @Nullable Object> value) |
UserMapBuilder | anyTypeProp(Void value) |
UserMapBuilder | anyTypeProp(boolean value) |
UserMapBuilder | anyTypeProp(String value) |
UserMapBuilder | anyTypeProp(int value) |
UserMapBuilder | anyTypeProp(float value) |
UserMapBuilder | anyTypeProp(long value) |
UserMapBuilder | anyTypeProp(double value) |
UserMapBuilder | anyTypeProp(List<?> value) |
UserMapBuilder | anyTypeProp(Map<String, ?> value) |
UserMapBuilder | anyTypeExceptNullProp(Void value) |
UserMapBuilder | anyTypeExceptNullProp(boolean value) |
UserMapBuilder | anyTypeExceptNullProp(String value) |
UserMapBuilder | anyTypeExceptNullProp(int value) |
UserMapBuilder | anyTypeExceptNullProp(float value) |
UserMapBuilder | anyTypeExceptNullProp(long value) |
UserMapBuilder | anyTypeExceptNullProp(double value) |
UserMapBuilder | anyTypeExceptNullProp(List<?> value) |
UserMapBuilder | anyTypeExceptNullProp(Map<String, ?> value) |
UserMapBuilder | anyTypePropNullable(Void value) |
UserMapBuilder | anyTypePropNullable(boolean value) |
UserMapBuilder | anyTypePropNullable(String value) |
UserMapBuilder | anyTypePropNullable(int value) |
UserMapBuilder | anyTypePropNullable(float value) |
UserMapBuilder | anyTypePropNullable(long value) |
UserMapBuilder | anyTypePropNullable(double value) |
UserMapBuilder | anyTypePropNullable(List<?> value) |
UserMapBuilder | anyTypePropNullable(Map<String, ?> value) |
UserMapBuilder | additionalProperty(String key, Void value) |
UserMapBuilder | additionalProperty(String key, boolean value) |
UserMapBuilder | additionalProperty(String key, String value) |
UserMapBuilder | additionalProperty(String key, int value) |
UserMapBuilder | additionalProperty(String key, float value) |
UserMapBuilder | additionalProperty(String key, long value) |
UserMapBuilder | additionalProperty(String key, double value) |
UserMapBuilder | additionalProperty(String key, List<?> value) |
UserMapBuilder | additionalProperty(String key, Map<String, ?> value) |
public static class UserMap
extends FrozenMap<String, @Nullable Object>
A class to store validated Map payloads
Modifier and Type | Method and Description |
---|---|
static UserMap | of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) |
Number | id() [optional] value must be a 64 bit integer |
String | username() [optional] |
String | firstName() [optional] |
String | lastName() [optional] |
String | email() [optional] |
String | password() [optional] |
String | phone() [optional] |
Number | userStatus() [optional] value must be a 32 bit integer |
FrozenMap<?> | objectWithNoDeclaredProps() [optional] |
@Nullable FrozenMap<?> | objectWithNoDeclaredPropsNullable() [optional] |
@Nullable Object | anyTypeProp() [optional] |
@Nullable Object | anyTypeExceptNullProp() [optional] |
@Nullable Object | anyTypePropNullable() [optional] |
@Nullable Object | getAdditionalProperty(String name) provides type safety for additional properties |
public static class AnyTypePropNullable
extends AnyTypeJsonSchema
A schema class that validates payloads
test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values.
Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema |
---|
validate |
public static class AnyTypeExceptNullProp
extends JsonSchema
A schema class that validates payloads
any type except 'null' Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object.
Modifier and Type | Field and Description |
---|---|
Class<? extends JsonSchema> | not = Not.class |
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) |
boolean | validate(boolean arg, SchemaConfiguration configuration) |
FrozenMap<String, @Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
FrozenList<@Nullable Object> | validate(List<?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public static class Not
extends NullJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.NumberJsonSchema |
---|
validate |
public static class AnyTypeProp
extends AnyTypeJsonSchema
A schema class that validates payloads
test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See OAI/OpenAPI-Specification#1389
Methods Inherited from class org.openapijsonschematools.client.schemas.AnyTypeJsonSchema |
---|
validate |
public static class ObjectWithNoDeclaredPropsNullable
extends JsonSchema
A schema class that validates payloads
test code generation for nullable objects. Value must be a map of strings to values or the 'null' value.
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());
// null validation
Void validatedPayload = User.ObjectWithNoDeclaredPropsNullable.validate(
(Void) null,
configuration
);
Modifier and Type | Field and Description |
---|---|
Set<Class<?>> | type = Set.of( Void.class, Map.class ) |
Modifier and Type | Method and Description |
---|---|
Void | validate(Void arg, SchemaConfiguration configuration) |
FrozenMap<String, @Nullable Object> | validate(Map<?, ?> arg, SchemaConfiguration configuration) |
@Nullable Object | validate(@Nullable Object arg, SchemaConfiguration configuration) |
public static class ObjectWithNoDeclaredProps
extends MapJsonSchema
A schema class that validates payloads
test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value.
Methods Inherited from class org.openapijsonschematools.client.schemas.MapJsonSchema |
---|
validate |
public static class UserStatus
extends Int32JsonSchema
A schema class that validates payloads
User Status
Methods Inherited from class org.openapijsonschematools.client.schemas.Int32JsonSchema |
---|
validate |
public static class Phone
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Password
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Email
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class LastName
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class FirstName
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Username
extends StringJsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
---|
validate |
public static class Id
extends Int64JsonSchema
A schema class that validates payloads
Methods Inherited from class org.openapijsonschematools.client.schemas.Int64JsonSchema |
---|
validate |